"Brand Bogard" <br**********@motorola.com> writes:
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:DZ**************@newsread2.news.pas.earthlink .net... "Brand Bogard" <br**********@motorola.com> wrote in message
news:e3**********@newshost.mot.com... > When creating a #define symbol like this,
>
> #define SYMBOL1_OFFSET 100
>
> #define SYMBOL2_OFFSET(SYMBOL1_OFFSET +\
>
> 50)
>
> The 50) is on a new line. Can there be any whitespace after the \
> character
> according to the standard?
Yes, as long as the first whitespace character
after the \ is a newline (\n).
And where is that little nugget piece of information documented? I'm not
questioning your answer, I just thought that standard was able to accomodate
more up to date parsers and lexers. Seems like a simple thing to allow.
It's documented in the standard.
Translation phase 2 is documented in C99 5.1.1.2p2:
Each instance of a backslash character (\) immediately followed by
a new-line character is deleted, splicing physical source lines to
form logical source lines. Only the last backslash on any
physical source line shall be eligible for being part of such a
splice. A source file that is not empty shall end in a new-line
character, which shall not be immediately preceded by a backslash
character before any such splicing takes place.
I agree that allowing arbitrary whitespace between a '\' and a
new-line character would be an improvement. As it is, a stray space
after a '\' can make a program illegal while being entirely invisible.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.