From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f868292008c639ce X-Google-Attributes: gid103376,public From: Florian Weimer Subject: Re: C vs. Ada - strings Date: 2000/05/05 Message-ID: <87og6lv6ix.fsf@deneb.cygnus.argh.org>#1/1 X-Deja-AN: 619495549 References: <390F0D93.F835FAD9@ftw.rsc.raytheon.com> <8es4ad$3d6$1@nnrp1.deja.com> <8esjc3$lp1$1@nnrp1.deja.com> Mail-Copies-To: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@cygnus.argh.org X-Trace: deneb.cygnus.argh.org 957509174 7443 192.168.1.2 (5 May 2000 06:46:14 GMT) Organization: Penguin on board User-Agent: Gnus/5.0806 (Gnus v5.8.6) Emacs/20.6 Mime-Version: 1.0 Reply-To: Florian Weimer NNTP-Posting-Date: 5 May 2000 06:46:14 GMT Newsgroups: comp.lang.ada Date: 2000-05-05T06:46:14+00:00 List-Id: Robert Dewar writes: > In article , > Robert A Duff wrote: > > > At least I think it's impl dependent -- perhaps I remembered > > > wrong, and it's always false :-) > > > > I think you remembered correctly. > I guess it's always false in K&R, unspecified in ANSI, is that > right? I'm sure that back in the old days, C didn't have string constants. Occasionally, you still see things like mktemp("/tmp/fileXXXXXX"), and mktemp() does write to the array argument. (Of course, you should never-ever use mktemp(), tmpnam() or tempnam(). Note that there is at least one Ada implementation which uses tmpnam() internally to create a name name for Ada temporary files, so be careful there as well.) Of course, nowadays, there are compilers which merge identical string constants, and linkers which put string constants into read-only data sections, and C99 says indeed: | It is unspecified whether these arrays are distinct provided their | elements have the appropriate values. If the program attempts to | modify such an array, the behavior is undefined.