Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: torek@elf.bsdi.com (Chris Torek)
Subject: Re: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA *
Date: 1998/08/31	[thread overview]
Message-ID: <6sfiai$lcu@elf.bsdi.com> (raw)
In-Reply-To: 6sei0r$745$1@usenet01.srv.cis.pitt.edu

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
<geest3+@pitt.edu> 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.



  reply	other threads:[~1998-08-31  4:00 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0095000017115526000002L062*@MHS>
     [not found] ` <35E04DF1.1911@world.std.com>
     [not found]   ` <35E09E76.6773@earthlink.net>
1998-08-23  4:00     ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Terry C. Shannon
1998-08-23  4:00       ` Glenn C. Everhart
1998-08-24  4:00         ` Paul Sture
1998-08-25  4:00           ` Gregg E Economou
1998-08-25  4:00             ` Jordan Henderson
1998-08-26  4:00               ` Bob Koehler
     [not found]                 ` <6s910k$2bo$1@Starbase.NeoSoft.COM>
1998-08-29  4:00                   ` Gregg E Economou
1998-08-30  4:00                     ` Jay Maynard
     [not found]                   ` <35e833be.0@news.wizvax.net>
1998-08-29  4:00                     ` Jordan Henderson
1998-08-30  4:00                       ` John Wilson
1998-08-30  4:00                         ` Lawrence Kirby
1998-08-30  4:00                           ` JF Mezei
1998-08-30  4:00                             ` Martin Ambuhl
     [not found]                             ` <6scur7$qtk@bgtnsc02.wo <35EA0E22.C59E9476@videotron.ca>
1998-08-31  4:00                               ` Will Rose
1998-08-31  4:00                             ` Michael Rubenstein
1998-08-31  4:00                             ` Craig Franck
1998-08-30  4:00                               ` JF Mezei
1998-08-31  4:00                                 ` firewind
1998-08-30  4:00                         ` JF Mezei
1998-08-30  4:00                           ` Chris Torek
1998-08-31  4:00                             ` Gregg E Economou
1998-08-31  4:00                               ` Chris Torek [this message]
1998-09-04  4:00                         ` Thor Lancelot Simon
1998-08-30  4:00                       ` Gregg E Economou
1998-08-30  4:00                         ` K&R fight over ketchup (was: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA ) Clint Comes
1998-08-31  4:00                           ` Bob Koehler
1998-09-05  4:00                             ` Gregg E Economou
1998-09-05  4:00                       ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Peter da Silva
1998-09-05  4:00                         ` Jordan Henderson
1998-09-07  4:00                           ` Peter da Silva
1998-09-07  4:00                             ` Jordan Henderson
1998-09-07  4:00                               ` Dan Pop
1998-09-07  4:00                               ` Richard Stamp
1998-09-07  4:00                               ` Peter da Silva
1998-09-07  4:00                                 ` Jordan Henderson
1998-09-08  4:00                                   ` Peter da Silva
     [not found]                                     ` <6t2im5$mke@espresso.cafe.net>
1998-09-08  4:00                                       ` Peter da Silva
1998-09-08  4:00                                     ` Peter da Silva
1998-09-08  4:00                                   ` Tim Shoppa
     [not found]                                     ` <6t4cui$hfu@espresso.cafe.net>
1998-09-09  4:00                                       ` Tim Shoppa
1998-09-08  4:00                                         ` JF Mezei
1998-09-09  4:00                                         ` Dan Pop
1998-09-09  4:00                                           ` Peter da Silva
1998-09-08  4:00                                   ` JF Mezei
1998-09-08  4:00                                 ` Dan Pop
1998-09-08  4:00                                   ` Peter da Silva
1998-09-08  4:00                                     ` Dan Pop
1998-08-25  4:00             ` John Wilson
1998-08-26  4:00               ` Gregg E Economou
1998-08-27  4:00                 ` John Wilson
1998-08-26  4:00             ` Bob Koehler
1998-08-27  4:00               ` Peter da Silva
1998-08-31  4:00                 ` Boris
1998-08-27  4:00               ` Thor Lancelot Simon
1998-08-28  4:00                 ` TERENCE MURPHY
1998-08-28  4:00                   ` Monty Brandenberg
1998-08-28  4:00                   ` Greg Thomas
1998-08-29  4:00                     ` mathog
1998-09-01  4:00                       ` Greg Thomas
1998-08-28  4:00                   ` George Cornelius
1998-08-29  4:00                   ` Gregg E Economou
1998-09-05  4:00                   ` Peter da Silva
1998-08-28  4:00                 ` Bob Koehler
1998-09-05  4:00                   ` Peter da Silva
1998-09-08  4:00                     ` Carl Perkins
1998-08-31  4:00                 ` Boris
1998-08-26  4:00             ` Paul Sture
1998-08-27  4:00               ` Gregg E Economou
1998-08-28  4:00                 ` Paul Sture
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox