This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: #elsif


Paul Eggert writes:
 >    Date: Tue, 7 Apr 1998 12:08:20 +0200 (MET DST)
 >    From: "Philippe De Muyter" <phdm@macqel.be>
 > 
 >    #if defined(A)
 > 	   printf("A defined\n");
 >    #elsif  defined(B)
 > 	   printf("B undefined\n");
 >    #else   /* nor A nor B */
 > 	   printf("nor A nor B defined\n");
 >    #endif
 > 
 > As I read the C standard, if A is not defined, then GCC is required to
 > accept that program fragment, though I admit the standard's wording is
 > not entirely clear.

I disagree.  While I agree that the standard could be clearer
about this, as I read it, a diagnostic must be issued for the
"elsif".

The syntax of preprocessing directives are clearly spelled out,
and "#elsif" does not fit.  The standard requires a diagnostic
if there is a syntax violation.

There is a passage in 3.8.1, in the context of explaining what
gets skipped by a false directive, "directives are processed
only through the name that determines the directive...".  In
this case the name is "elsif" which does not fit syntacticly.

If you read it differently Paul, show us what you see.

                                        -gavin...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]