Are the criteria for Unix and PC compilers different?

Michael Meissner meissner at xyzzy.UUCP
Thu Mar 10 07:29:13 AEST 1988


In article <2232abb7 at ralf.home> Ralf.Brown at B.GP.CS.CMU.EDU writes:
| In article <7451 at oberon.USC.EDU>, blarson at skat.usc.edu (Bob Larson) writes:
| }In article <22314ad9 at ralf.home> Ralf.Brown at B.GP.CS.CMU.EDU writes:
| }>#define int long
| }
| }* Does not work on compilers that don't allow #define of a keyword.
| 
| I wasn't aware of any preprocessors smart enough to disallow #defines of
| keywords.  The preprocessor's knowledge of C is limited to recognizing tokens;
| it doesn't "know" C, it just does the textual substitution.

In the traditional UNIX/cpp yes, /lib/cpp "only" recognizes tokens.  It is
not engraved in stone tablets, that this is the one true course.  Other
compilers have the preprocessor integrated in the compiler proper, and yes
some of those do warn and/or disallow #define'ing keywords.  For instance,
early rev's of the Data General C compiler gave warnings about that, as well
as some of the micro compilers.
-- 
Michael Meissner, Data General.		Uucp: ...!mcnc!rti!xyzzy!meissner
					Arpa/Csnet:  meissner at dg-rtp.DG.COM



More information about the Comp.lang.c mailing list