From: JF Mezei <jfmezei.spamnot@videotron.ca>
Subject: Re: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA *
Date: 1998/08/30 [thread overview]
Message-ID: <35EA0E22.C59E9476@videotron.ca> (raw)
In-Reply-To: 6scur7$qtk@bgtnsc02.worldnet.att.net
> >1- The list of reserved words does not include function calls.
>
> Yes it does.
I suggest you check Kernigham and Ritchie, 1978 edition. Appendix A (starts at
page 214)
Or better yet, the official list of reserved words at page 180 (again appendix A).
> >The compiler has no idea what "printf" is supposed to do.
>
> A compiler is allowed to know exactly how printf is supposed to
> function.
Nop, because the compiler does not know to what library the object module will
eventually be linked with. Case in point: on a VAX-VMS, you can link against
the VAXCRTL or DECCRTL libraries, which, while similar, have significant differences.
Obviously, if you work on a system where the linker is integrated in the
compiler, there may be
some optimisations that are permissible if the compiler-linker knows you will
link against that
supplied libraries. But that is an implementation "derivative", not part of
the language.
> For example, having two printfs to deal with invokes undefined-
> behavoir.
Some linkers allow this to happen through the use of "search order" and a
switch to allow
this. Furthermore, the compiler has no idea that during the link operation,
instead of supplying
the standard run-time as a library, you will supply a different library.
Quoting from K&R, page 1:
"Finally, C itself provides no input-output facilities: there are no READ or
WRITE statements,
and no wired-in file access methods. All these higher-level mechanisms *MUST*
be provided by
explicitely called functions."
(emphasis on MUST is mine).
By that definition alone, a compiler which assumes a certain behaviour for
printf and translates it to inline code instead of a call to the printf
routine in a library would not adhere to the C
standards. Must be a Microsoft compiler.
> Also, a macro may get exapanded or a function called based on
> how it's being used. That is part of the language.
Disagree. If you do not have a #include that defines the macro, the use of
your "keyword" will
result in a function call to be resolved by the linker. If you have a #include
with a #define for
your keyword, that keyword will get expanded during the pre-processor stage,
prior to actual compilation.
On the good old VAXC, the lack of #include <string.h> would result in
references to isnum(char)
being compiled as a function call. When you included string.h, isnum(char)
would be expanded in
macro which did the same job (but more efficiently).
This varies from implementation to implementation. And it is not part of the
actual C language.
And you should note that it is not the compiler which generates the "inline
code" but rather
the pre-processor which converts a keyword into a list of C language
statements which are then compiled as if you had typed them in.
next prev parent reply other threads:[~1998-08-30 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 ` John Wilson
1998-08-26 4:00 ` Gregg E Economou
1998-08-27 4:00 ` John Wilson
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 ` 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-08-30 4:00 ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * 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 [this message]
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
1998-09-04 4:00 ` Thor Lancelot Simon
1998-09-05 4:00 ` 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 ` Richard Stamp
1998-09-07 4:00 ` Dan Pop
1998-09-07 4:00 ` Peter da Silva
1998-09-07 4:00 ` Jordan Henderson
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 ` Peter da Silva
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 ` 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-26 4:00 ` Paul Sture
1998-08-27 4:00 ` Gregg E Economou
1998-08-28 4:00 ` Paul Sture
1998-08-26 4:00 ` Bob Koehler
1998-08-27 4:00 ` Thor Lancelot Simon
1998-08-28 4:00 ` TERENCE MURPHY
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 ` Monty Brandenberg
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-27 4:00 ` Peter da Silva
1998-08-31 4:00 ` Boris
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