Conditional compilation directives must be the first non-white space for a line.
A single-line comment may follow on the same line as conditional-compilation directives other than pp-control-line directives. For example,
#define Debug // Defined if the build is a debug build
For pp-control-line directives, the remainder of the line constitutes the pp-message, independent of the contents of the line. The example
#warning // TODO: Add a better warning
results in a warning with the contents "// TODO: Add a better warning
".
A multi-line comment may not begin or end on the same line as a conditional compilation directive. The example
/* This comment is illegal because it ends on the same line*/ #define Debug /* This is comment is illegal because it is on the same line */ #define Retail #define A /* This is comment is illegal because it is on the same line */ #define B /* This comment is illegal because it starts on the same line */
results in a compile-time error.
Text that otherwise might form a conditional compilation directive can be hidden in a comment. The example
// This entire line is a commment. #define Debug /* This text would be a cc directive but it is commented out: #define Retail */
contains no conditional compilation directives, and consists entirely of white space.