shared storage for string literals?
Doug Gwyn
gwyn at smoke.brl.mil
Wed May 29 17:35:53 AEST 1991
In article <21996 at ogicse.ogi.edu> vegdahl at ogicse.cse.ogi.edu (Steve Vegdahl) writes:
>The ANSI standard states that two identical string literals may share storage.
Actually it says that identical string literals need not be distinct.
>Question: can non-identical substrings share storage if one is a substring
>of the other, and they share a common "tail"?
Sure. The standard doesn't allow a strictly conforming program to modify
string literals, so this would be a safe implementation practice, and I
would be greatly surprised if no C implementation were doing this.
Surely any application that depended on nonoverlap would be depending on
something that the standard does not guarantee.
More information about the Comp.lang.c
mailing list