Preprocessing directives (lines that start with #
) can be used to conditionally include or exclude code from compilation. Malformed
preprocessing directives could lead to the exclusion or inclusion of more code than was intended. Therefore all preprocessing directives should be
syntactically meaningful.
Noncompliant code example
#define AAA 2
...
int foo(void)
{
int x = 0;
...
#ifndef AAA
x = 1;
#else1 /* Noncompliant */
x = AAA;
#endif
...
return x;
}
Compliant solution
#define AAA 2
...
int foo(void)
{
int x = 0;
...
#ifndef AAA
x = 1;
#else
x = AAA;
#endif
...
return x;
}