From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,2afd440a210c7fb0 X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,df8a3dc583bf1f5f X-Google-Attributes: gid1164f8,public X-Google-Thread: 1014db,6bdc5c27a0dec527 X-Google-Attributes: gid1014db,public From: torek@elf.bsdi.com (Chris Torek) Subject: Re: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Date: 1998/08/31 Message-ID: <6sfiai$lcu@elf.bsdi.com>#1/1 X-Deja-AN: 386636773 References: <0095000017115526000002L062*@MHS> <35E9DAA0.8097B24F@videotron.ca> <6scnqc$ilb@elf.bsdi.com> <6sei0r$745$1@usenet01.srv.cis.pitt.edu> X-Complaints-To: abuse@cs.umd.edu X-Trace: cronkite.cs.umd.edu 904613237 11207 205.230.228.129 (1 Sep 1998 01:27:17 GMT) Organization: none of the above NNTP-Posting-Date: 1 Sep 1998 01:27:17 GMT Newsgroups: comp.os.vms,comp.sys.dec,comp.lang.c In article <6scnqc$ilb@elf.bsdi.com> I noted that GCC inlines various "library" calls -- that is, things that look like ordinary function calls, in C code, turn out not to be function calls at all. In article <6sei0r$745$1@usenet01.srv.cis.pitt.edu> Gregg E Economou writes: >That's an optimization feature of your compiler, >not a feature of the underlying language. The key question is: Is this optimization feature allowed by the language definition (ANSI X3.159 / ISO 9899)? If you say "no": Why not? If you say "yes": What does that tell us about users redefining the standard library functions themselves? For those who do not have the time to look at the standard, and are willing to believe me, the answer to the "key question" above is "yes, this optimization feature is in fact allowed by the language definition". As an implementor, I must of course supply all those functions that the compiler does not open-code in this manner. (I even have to supply the open-coded memcpy, because someone might call memcpy through a function pointer. This function need not be named "memcpy", though -- since the compiler does in fact recognize "calls" to memcpy, I might have to supply instead a function named something like "_Cruntime__stdstringf__copy_nonoverlap", or perhaps I might have to supply two routines __libc_noerrchk_memcpy and __libc_errchk_memcpy, for two different compilation environments, one of which performs runtime error-checking.) As a user of the C language, however, I should not attempt to subvert any of the implementation's functions. If I do, I may find I have tied myself to a particular set of implementations, or I might discover that I cannot use the optimization features of my compiler. None of this means you *cannot* subvert your compiler. It just means that if and when you do, you cannot generalize the result to "all C compilers". If I were to claim that supplying your own memcpy(), that consisted of a call to exit(), never made memcpy exit, you would probably wonder where I got that idea. But I can prove that at least one C program that appears to call this "exiting memcpy" does in fact continue after the call, on at least one system, in at least one mode. "It works that way on my compiler" does *not* mean "it must work that way everywhere". -- In-Real-Life: Chris Torek, Berkeley Software Design Inc El Cerrito, CA Domain: torek@bsdi.com +1 510 234 3167 Antispam notice: unsolicited commercial email will be handled at my consulting rate; pyramid-scheme mail will be forwarded to the FTC.