Path: utzoo!mnetor!uunet!husc6!necntc!ames!ptsfa!ihnp4!uniq!dfm From: dfm@uniq.UUCP (Meyer) Newsgroups: comp.lang.c Subject: Re: (So-Called) ANSI C Message-ID: <400@uniq.UUCP> Date: 23 Dec 87 16:38:23 GMT References: <4668@pyr.gatech.EDU> <2046@haddock.ISC.COM> Sender: news@uniq.UUCP Organization: Uniq Digital Technologies, Batavia, IL Lines: 26 Summary: string literals are not writable In article <2046@haddock.ISC.COM> karl@haddock.ISC.COM (Karl Heuer) writes: > ... > The only one that springs to my mind is mktemp("fooXXXXXX") (because it's no > longer safe to assume that string literals are writable). I can't remember where it was (maybe some obscure version within AT&T, like MERT or one of their early 3B series), but there was an implementation where string constants were put in read-only (text??) memory, and changing them produced a memory fault or protection violation or some other core- producing signal. Even worse, there was one implementation (I believe it was IS/1, a UNIX emulator that ran on VMS, from Interactive Systems), where the first page of data was write-protected (this had the beneficial side effect of catching references through a NULL pointer) but the rest was not, so most string literals wer writable but some weren't. Since then, I have never assumed that I could write into a literal. Dennis F. Meyer ...ihnp4!uniq!dfm Uniq Digital Technologies 28 S. Water St. Batavia, IL 60510 312/879-1566