It is preferable to declare immutable values using const
, rather than as macro definitions. Using a const
declared value means that the compiler is able to check the type of the object, the object has scope, and debugging tools will be able to show the name of the object. For integer constants, it is preferable to use an enum
as this guarantees that storage will not be required instead of a const-qualified object as this eliminates the possibility of taking the address of the integer constant and does not required that storage is allocated for the value.
Non-Compliant Code Example 1
...