MISRA C++:2008 Rule 16-2-2

C++ macros shall only be used for: include guards, type qualifiers, or storage class specifiers

Description

Rule Definition

C++ macros shall only be used for: include guards, type qualifiers, or storage class specifiers.

Polyspace Implementation

The checker flags #define statements where the macros expand to something other than include guards, type qualifiers or storage class specifiers such as static, inline, volatile, auto, register and const.

Troubleshooting

If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.

Check Information

Group: Preprocessing Directives
Category: Required
Introduced in R2013b