Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If a constant value is given for an identifier, do not diminish the modifiability of the code in which it is used by assuming its value in expressions. Just Simply giving the constant a name is not enough to ensure modifiability; you must be careful to always use the name, and remember that the value can change. This recommendation is related to DCL06-A. Use meaningful symbolic constants to represent literal values in program logic.

...

Most modern C compilers will optimize this code appropriately.

Risk Assessment

Hardwiring constants renders code potentially nonportable; in fact, it will Assuming the value of an expression diminishes the maintainability of code and can produce unexpected behavior under any circumstances in which the constant changes.

...