Path: utzoo!attcan!uunet!epiwrl!epimass!jbuck From: jbuck@epimass.EPI.COM (Joe Buck) Newsgroups: comp.std.c Subject: Re: my two cents Keywords: string constant Message-ID: <2372@epimass.EPI.COM> Date: 8 Aug 88 16:26:01 GMT References: <5812@batcomputer.tn.cornell.edu> Reply-To: jbuck@epimass.EPI.COM (Joe Buck) Distribution: comp Organization: Entropic Processing, Inc., Cupertino, CA Lines: 27 In article <5812@batcomputer.tn.cornell.edu> davidra@batcomputer.tn.cornell.edu (David A. Rabson) writes: >I just got my hands on a copy of the second edition of K&R and was >distressed to read that "[string constants] are no longer modifiable, >and so may be placed in read-only memory." >This will cause mktemp() and many, many other things to break. It only causes certain uses of mktemp to break. You can no longer say name = mktemp ("/tmp/fileXXXXXX"); but you can say char template[] = "/tmp/fileXXXXXX", *name; name = mktemp (template); I know of no other code I've ever written that this change would break. But then, I do a lot of C code for standalone applications (C in ROM, with a minimal real-time OS) and in the compiler I use for that, strings go in a separate section and I put that section in ROM. There's also the Berkeley xstr hack, for collecting commonly used strings and compressing. This will only work if you don't attempt to modify strings. -- - Joe Buck {uunet,ucbvax,pyramid,}!epimass.epi.com!jbuck jbuck@epimass.epi.com Old Arpa mailers: jbuck%epimass.epi.com@uunet.uu.net If you leave your fate in the hands of the gods, don't be surprised if they have a few grins at your expense. - Tom Robbins