| Use symbolic names for
constants |
In general all numeric constants should be defined
symbolic names either through C's preprocessor's #define or with a const
definition. |
| Put digits on both sides of a
floating point value |
Floating point literals should include digits on both
sides of the decimal point.
|
| Hexadecimal constants should
use capitals "A" through "F" and small "x" |
Hexadecimal numbers should always have the
"x" in lowercase and the letters "A" through "F" in
uppercase. This will promote the hexadecimal literal number to look more like a constant
instead of a variable. Another good rule of thumb is to always make a hexadecimal number
an even number of characters.
| Bad |
0Xace |
0xbad0 |
| Good |
0x0ACE |
0xBAD0 |
|
| Long word constants should
use capital "L" suffix |
Long int numbers should be followed by an uppercase
"L" since a lowercase "l" could be confused with the number one
("1").
|