The diagnostic directives are used to explicitly generate error and warning messages that are reported in the same way as other compile-time errors and warnings.
pp-diagnostic:
whitespaceopt # whitespaceopt error pp-message
whitespaceopt # whitespaceopt warning pp-message
pp-message:
new-line
whitespace input-charactersopt new-line
The example:
#warning Code review needed before check-in
#if Debug && Retail
#error A build can't be both debug and retail
#endif
class Test {...}
always produces a warning (“Code review needed before check-in”), and produces a compile-time error (“A build can’t be both debug and retail”) if the conditional symbols Debug and Retail are both defined. Note that a pp-message can contain arbitrary text; specifically, it need not contain well-formed tokens, as shown by the single quote in the word can’t.
Do'stlaringiz bilan baham: |