...
Code Block | ||
---|---|---|
| ||
float const pi = 3.14159; ... float degrees; float radians; ... radians = degrees*PIpi/180; |
Non-Compliant Code Example 2
...
Code Block | ||
---|---|---|
| ||
#define MAX 42 ... for (int i = 0; i < MAXmax; ++i) { ... } |
Compliant Solution 2
...
Values declared using const
cannot be used where compile-time constants are required. So, a const-qualified value cannot be used to specify the
*size of a bit-field member of a structure
*size of an array
*value of an enumeration constant
*value of a case
constant.
If any of these are required, then an enum
or a macro definition must be used.
...