home > resources > c++ coding standard > online version

#define and Macro Names

  • Put #defines and macros in all upper using '_' separators.

Justification

  • This makes it very clear that the value is not alterable and in the case of macros, makes it clear that you are using a construct that requires care.
  • Some subtle errors can occur when macro names and enum labels use the same name.

Example 2-17. #define and Macro Names Example

#define MAX(a,b) blah
#define IS_ERR(err) blah