Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-12-20 04:47:02


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Paul Mensonides

> > So if I understand you correctly, it should just skip over any
> > gibberish it might encounter until the matching #endif is found?
>
> Yes, except that it still must tokenize the block. You can
> still get errors in tokenization, such as:
>
> #if 0
> "half-open // error
> #endif
>
> > Is the preprocessor allowed to issue warnings about the gibberish?
>
> The main point about the above is that the block must be
> tokenized, but it should not be parsed to produce directives
> or scanned for macro replacement.

What I said here isn't quite correct, so I'll elaborate. The block has to be
parsed just enough to determine nested conditional compilation blocks. E.g.

#if 0
   #if 0
   #endif
#endif

...but it isn't supposed to parse anything else--including an operands to
directives. So, the following should still work:

#if 0
   #if // no expression!
   #endif
#endif

So, basically, the only parse is to tell if a name following '#' on a new line
is one of the conditional compilation directives or not. Specifically, from
16.1/6, "...the group that it controls is skipped: directives are processed only
through the name that determines the directive in order to keep track of the
level of nested conditionals; the rest of the directives' preprocessing tokens
are ignored, as are the other preprocessing tokens in the group."

Regards,
Paul Mensonides


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk