There is no language requirement for preprocessor output, which must be valid C ++, or even for the preprocessor output to be available. But the preprocessor, which usually uses g ++ (perhaps always?), Generates output, which itself can be compiled as C ++.
What does the statement # int string int mean?
Any line starting with # is a preprocessing directive. If the token following # is not recognized otherwise, the part of the line after # is not a directive. (Despite the name, the preprocessing directive is not a directive.) Faults are usually ignored.
Usually this is a preprocessor that processes all preprocessing directives, including non-directives, but in this case some lines starting with # are passed to the compiler itself, which knows to ignore them.
You can demonstrate this by feeding the preprocessor output to the compiler:
g++ -E foo.cpp > foo_preprocessed.cpp g++ -c foo_preprocessed.cpp
If foo.cpp has preprocessor directives, in particular #include directives, foo-preprocessed.cpp will probably be much larger - but the compiler can still handle it.
The language standard defines the preprocessor output in terms of tokens rather than tex, but it provides sufficient flexibility so that the text is a valid way of representing the desired sequence of tokens.
(All this applies to both C and C ++.)
source share