TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  6.10.3.5.aChecked automatically with code checker

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 */
   ...
}