-
Notifications
You must be signed in to change notification settings - Fork 19
Preprocessor
Roy Eltham edited this page Apr 7, 2020
·
4 revisions
The preprocessor is on by default. You can turn it off with the -p command line option.
- #define FOO
- simple macros with no arguments, basic substitution & #ifdef checking
- #undef
- #ifdef FOO / #ifndef FOO
- #else / #elseifdef FOO / #elseifndef FOO
- #endif
- #error message
- #warning message
- #info message
- #include “file”
If you use the -a command line option, that will turn on alternative mode for the preprocessor. The difference is in how #define and #error work.
For #define, if you just define something (e.g. #define FOO or use the -D command line option) then it will not perform substitution in the code. It will just satisfy #ifdef and similar checks.
For #error, it will exit the compiler immediately after displaying the error message.