Standardized predefined CPP symbols, down with folklore
Andrew Klossner
andrew at orca.UUCP
Thu Jul 12 07:06:39 AEST 1984
[]
"Actually, it wouldn't matter if the implementors had had the
sense to have cpp implcitly "#define unix unix", instead of
"#define unix 1". The first would still permit all "#ifdef
unix" work, while the actual implementation caused me grief one
day when I tried to create a function called unix()"
Nope. "#define unix unix" followed by a use of "unix" will put the
preprocessor into a loop, scanning "unix" over and over, until the
recursion depth is hit and it punts with a fatal error message.
Here's what it does under 4.2BSD:
% cat >unix.c
#define unix unix
unix() {}
% cc unix.c
unix.c: 1: unix redefined
unix.c: 2: unix: macro recursion
%
-- Andrew Klossner (decvax!tektronix!orca!andrew) [UUCP]
(orca!andrew.tektronix at rand-relay) [ARPA]
More information about the Comp.lang.c
mailing list