Problems with GCC and/or VAX LINK

Henry Spencer henry at utzoo.uucp
Sun Mar 19 08:26:22 AEST 1989


In article <kY89tBy00hYPNFGX1Q at cs.cmu.edu> rpd at cs.cmu.edu (Richard Draves) writes:
>First, I'd like to know if a #if in one file can be matched by a #else or #endif
>in another file.

If you read the ANSI stuff carefully (Oct draft), the BNF that defines the
#if-#endif matching is a BNF for a *single* file.  So the answer is no.

>Second, I'd like to know if when one is skipping over tokens looking for a #else
>or #endif, one is entitled to skip #include directives without substituting the
>file.

This behavior is not only permissible, it is required.  The rule is that
preprocessor directives in a skipped section are examined only up to the
keyword following the "#", to keep track of #if nesting.  As I read it,
the rest of an ignored directive doesn't even need to be syntactically legal,
although it does have to consist of legal preprocessing tokens.  If you
think about it, this is highly desirable:  one reason for #if-ing out a
piece of code is that it uses implementation-specific features that
don't exist in the implementation it's currently being compiled on.
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list