Expressions and statements
ES.9
Avoid `ALL_CAPS` names
Reason
Such names are commonly used for macros. Thus, ALL_CAPS name are vulnerable to unintended macro substitution.
Example
// somewhere in some header:
#define NE !=
// somewhere else in some other header:
enum Coord { N, NE, NW, S, SE, SW, E, W };
// somewhere third in some poor programmer's .cpp:
switch (direction) {
case N:
// ...
case NE:
// ...
// ...
}
Note
Do not use ALL_CAPS for constants just because constants used to be macros.
Enforcement
Flag all uses of ALL CAPS. For older code, accept ALL CAPS for macro names and flag all non-all-CAPS macro names.