Reserved words in C

Doug Gwyn gwyn at brl-smoke.ARPA
Tue Jan 6 04:39:59 AEST 1987


In article <1016 at zeus.UUCP> dant at tekla.tek.com (Dan Tilque) writes:
>When I first learned C, there were about 80 or so words I needed to
>learn (reserved words, preprocessor commands, frequently used routine
>names and some miscellaneous).  I didn't have to learn the library
>routine names or #defines in headers I never used. 

In a hosted environment, one's code is normally linked against
a "standard C library" that contains entry points for routines
such as fflush() etc.  Because some library routines might
invoke others (unbeknownst to the user), it has always been
unwise for the user to provide his own externally-visible
functions with the same names as any library extern, whether
or not he thought it wasn't being used.  X3J11 hasn't done
anything new in this regard except to standardize a subset of
the C library and to introduce a handful of new externs/macros.

Please note that a conforming implementation is not permitted
to have any extensions that could alter the behavior of a
strictly conforming program; one implication of this is that
non-X3J11 entry points starting with anything other than _ must
NOT be present in the implementation's standard C library.
This isn't as bad as it sounds, since for example the UNIX "cc"
could require use of a flag to obtain a conforming environment
(the best way to implement this might be to provide the pure
X3J11 environment as a separate-but-equal library that invokes
system calls using names such as _read() instead of read()).
I'm not sure that's what X3J11 intended, but it's what I deduce
from section 1.6 of the Draft Proposed Standard; however, one
wonders why "additional library functions" are mentioned if
they would be so hard to provide (basically, there would have
to be a header file that redefined the externs as _-names).



More information about the Comp.lang.c mailing list