Are comments always processed before the preprocessor?
c, c-preprocessor, comments
Solution
I assume that comments are processed first, then preprocessor, and then code. Are comments always processed before the preprocessor?
Sort of -- part of the preprocessor's job is to remove comments. In this case, it doesn't care that you have the directive inside the comments; it's still removed just like any other comment.
Problem
``` /* #define FOO */ #ifdef FOO #define BAR "pirate" #else #define BAR "ninja" #endif int main() { printf(BAR); getchar(); } ``` In this code FOO is not defined (Visual Studio 2008). I assume that comments are processed first, then preprocessor, and then code. Are comments always processed before the preprocessor? Is this part of a standard?