Standard Clarification

Tim_CDC_Roberts at cup.portal.com Tim_CDC_Roberts at cup.portal.com
Sat Oct 21 02:54:27 AEST 1989


While attepting to test some of the entries in the Obfuscated C Contest,
I find that Microsoft C 5.0 fails to compile constructs such as the
following:

    #define d define
    #d a include
    #a <stdio.h>

MSC complains that "d" is an unknown preprocessor directive and aborts.
Does the standard require that this construct should compile correctly?

I also encountered one occurrance of something like the following:

    #include <stdio.h>
    #define abcde getchar
           ...
      ch = abcde();

The preprocessor substituted 'getchar' for 'abcde', but then failed to
expand the 'getchar()' macro from stdio.  This resulted in an "Unresolved
External: _getchar" at load time.  Isn't the preprocessor legally and 
morally bound to recursively substitute macros, at least until a cycle
is found?

Tim_CDC_Roberts at cup.portal.com                |  I Survived The
...!sun!portal!cup.portal.com!tim_cdc_roberts |  Great Quake of '89.



More information about the Comp.lang.c mailing list