Richard said:
Nickolai Leschov said:
Eric has already answered this, but in case you want to know why the
comment is not preserved, the answer is that comments are removed in
Translation Phase 3, whereas macro expansions don't occur until
Translation Phase 4. Even in implementations where things aren't done in
precisely that order, the end result must be as if they had. Thus, the
Standard guarantees that the comment will not survive.
... which in turn raises the question of why the
translation phases are defined in this particular way.
The best answer I have for that question is that the
preprocessor is not really a manipulator of text, but
a manipulator of tokens[*] that are extracted from
the text. The tokens in the given definition are
#
define
MAJOR_VERS
6
.... and that's all: Comments, like other forms of
white space, are not tokens.
[*] "Preprocessing tokens," actually; the Standard
found it necessary to distinguish between the tokens
the preprocessor works on and those that the later
compilation phases work with.