Syntax

#define // Defines a compiler symbol.
#undef // Undefines a compiler symbol.
#warning // Generates a compiler warning. Useful with #if.
#error // Generates a compiler error. Useful with #if.
#line // Overrides the compiler line number (and optionally source file name). Used with .
#pragma warning [disable|restore] // Disables/restores compiler warnings.
#pragma checksum “” “” “” // Validates a source file’s contents.
#region // Defines a collapsible code region.
#endregion // Ends a code region block.
#if // Executes the code below if the condition is true.
#else // Used after an #if.
#elif // Used after an #if.
#endif // Ends a conditional block started with #if.

Remarks

Preprocessor directives are typically used to make source programs easy to change and easy to compile in different execution environments. Directives in the source file tell the preprocessor to perform specific actions. For example, the preprocessor can replace tokens in the text, insert the contents of other files into the source file, or suppress compilation of part of the file by removing sections of text. Preprocessor lines are recognized and carried out before macro expansion. Therefore, if a macro expands into something that looks like a preprocessor command, that command is not recognized by the preprocessor.

Preprocessor statements use the same character set as source file statements, with the exception that escape sequences are not supported. The character set used in preprocessor statements is the same as the execution character set. The preprocessor also recognizes negative character values.

Conditional Expressions

Conditional expressions (#if, #elif, etc) do support a limited subset of boolean operators. They are: