by yakubin · 5y ago · 0 comments
But generally I disagree that preprocessor is separate from C for the following reasons:
1. It is specified by the C standard.
2. Different C compilers implement it differently, just like they implement other parts of C differently.
3. There is some truth in the claim that it is a separate text transformation, but here I also do not agree entirely, because the C standard doesn't say that the preprocessor outputs text. It says that it outputs tokens and those tokens are then converted to tokens of C proper[1]. It is also clear that this model of "text transformation" is also not entirely what happens in real world compilers, because if it did we wouldn't get good backtraces for tokens that went out of the preprocessor after substitution. Maybe GCC serializes it to text at some point, but clearly it gets more information out of it than what a naive interpretation of the phrase "text transformation" would suggest.
[1]: Translation phase 7 of the C11 standard:
> Each preprocessing token is converted into a token.
No comments yet.