Is this kosher?

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Dec 7 02:11:48 AEST 1989


In article <1047 at dinorah.wustl.edu> art at dinorah.wustl.edu (Arthur B. Smith) writes:
>    In particular, is it safe to assign the address of the string
>literal in the list and assume that the contents of that address do
>not change when in another function?

Yes, string literals have static storage duration.  Only register
and auto objects end their lifetimes when leaving the block.

Be careful you don't feed a string literal to free().

>I cannot find anywhere that indicates the linkage for the string constant.

Linkage is not relevant here.  (Linkage basically has to do with
whether or not the identifier is visible to other translation units.)



More information about the Comp.lang.c mailing list