2006-11-03 said:
The standard does not describe the preprocessor as processing text but
as processing tokens.
I think it does describe how whitespace is treated. Comments, for
example, are defined as expanding to a space, _not_ as being an
invisible token splitter. I don't think macro expansions are defined as
being expanded surrounded by whitespace, "if necessary" or otherwise.
Now, the only way to tell is to use the stringize operator, so let's
come up with an example
#define N 0xE
#define s(x) #x
#define S(x) s(x)
S(a/**/b)
S(N+1)
is the case I was thinking of, but GCC seems to handle this properly. We
have "a b" and "0xE+1".
gcc -E gives a textual output which when tokenized provide the same
streams of tokens as preprocessing the original file.
And it seems smart enough to only do it when there can be no visible
difference (i.e. not under stringize). That was what I was worried
about. Anyway, other compilers might not be as smart, and using the
"preprocessor only" output may result in text output that cannot be
retokenized properly.