String assignments; Was: When is a cast not a cast?

Mark A Terribile mat at mole-end.UUCP
Thu May 4 17:22:10 AEST 1989


> > | 7	c = "somestring";  /* Nothing fancy, null-terminated. */
 
> Now I always thought this kind of thing was extremely bad form, ... But what
> if the compiler decides that ``somestring'' has finished its duty to the
> program, and overwrites the space it took with something else? ...

> Have I been misguided all this time?


Both K&R-I and K&R-II, in the appendices, under the heading ``String
Constants'', declare that a string has the storage class  static , which
means that the lifetime of the object is the lifetime of the program.

-- 

(This man's opinions are his own.)
>From mole-end				Mark Terribile



More information about the Comp.lang.c mailing list