This topic has not yet been rated - Rate this topic

2.5.2 Pre-processing expressions

Visual Studio .NET 2003

Pre-processing expressions can occur in #if and #elif directives. The operators !, ==, !=, && and || are permitted in pre-processing expressions, and parentheses may be used for grouping.

pp-expression:
whitespaceopt   pp-or-expression   whitespaceopt
pp-or-expression:
pp-and-expression
pp-or-expression   whitespaceopt   ||   whitespaceopt   pp-and-expression
pp-and-expression:
pp-equality-expression
pp-and-expression   whitespaceopt   &&   whitespaceopt   pp-equality-expression
pp-equality-expression:
pp-unary-expression
pp-equality-expression   whitespaceopt   ==   whitespaceopt   pp-unary-expression
pp-equality-expression   whitespaceopt   !=   whitespaceopt   pp-unary-expression
pp-unary-expression:
pp-primary-expression
!   whitespaceopt   pp-unary-expression
pp-primary-expression:
true
false
conditional-symbol
(   whitespaceopt   pp-expression   whitespaceopt   )

When referenced in a pre-processing expression, a defined conditional compilation symbol has the Boolean value true, and an undefined conditional compilation symbol has the Boolean value false.

Evaluation of a pre-processing expression always yields a Boolean value. The rules of evaluation for a pre-processing expression are the same as those for a constant expression (Section 7.15), except that the only user-defined entities that can be referenced are conditional compilation symbols.

Did you find this helpful?
(1500 characters remaining)