Naming and layout suggestions
NL.9
Use `ALL_CAPS` for macro names only
Reason
To avoid confusing macros with names that obey scope and type rules.
Example
void f()
{
const int SIZE{1000}; // Bad, use 'size' instead
int v[SIZE];
}
Note
In particular, this avoids confusing macros with non-macro symbolic constants (see also Enum.5: Don't use ALL_CAPS for enumerators)
enum bad { BAD, WORSE, HORRIBLE }; // BAD
Enforcement
- Flag macros with lower-case letters
- Flag
ALL_CAPSnon-macro names