Synopsis: | Macros shall only be #define'd and #undef'ed at file scope. |
Language: | C |
Severity Level: | 4 |
Category: | Preprocessing Directives |
Description: |
Justification Although macro names are not affected by the C scoping rules, using #define inside a C scope looks very confusing - programmers tend to forget that such macros are still accessible outside that scope. Example void f(void) { int i = 0; int j = 0; ... #define MIN_VAL 4 /* WRONG */ ... } |