AutosarC++19_03-M16.1.1¶
The defined preprocessor operator shall only be used in one of the two standard forms
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
[Undefined 16.1(4)]
Rationale
The only two permissible forms for the defined preprocessor operator are:
defined ( identifier )
defined identifier
Any other form is a constraint violation, but this is not reported by all compilers.
Example
#if defined ( X > Y ) // Non-compliant – constraint violation
Generation of the token defined during expansion of a #if or #elif preprocessing directive also leads to undefined behaviour and shall be avoided, for example:
#define DEfiNED defined
#if DEfiNED(X) // Non-compliant - undefined behaviour
Note
For legal reasons, this rule’s description is not part of the public documentation.