3 ms·
The preprocessor doesn't remove comments and at least in clang, comments are parsed into the AST.
by gridlockd 6y ago
The preprocessor doesn't remove comments and at least in clang, comments are parsed into the AST.
- dvfjsdhgfv 6y agoWell, according to C99, it should. Section "5.1.1.2 Translation phases" says (in phase 3): "Each comment is replaced by one space character." Edit: just checked and clang behaves just like gcc with -E. Maybe you didn't mean comments but preprocessor directives?
- deleted 6y ago[deleted]
- tom_mellior 6y agoClang, like GCC, has -C and -CC flags to preserve comments during preprocessing. However, these are really flags for the underlying preprocessor. Your parent might be thinking of some application of the Clang frontend that does not run preprocessing. For example, clang-format will probably not want to preprocess the code nor strip out comments.
- gridlockd 6y agoYou are correct, my bad.