Versions Compared

Key

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

Wiki Markup
Immutable objects should be {{const}}\-qualified.  Enforcing invariants such as object immutability using existing {{const}}\-qualification helps ensures the correctness and security of applications.  For example, ISO/IEC PDTR 24772 \[[ISO/IEC PDTR 24772|AA. C References#ISO/IEC PDTR 24772]\], for example, recommends labeling parameters as constant to avoid the unintentional modification of function arguments.
The C programming language has two mechanisms for enforcing immutability: constants and const-qualified objects. Constants include integer constants, floating constants
enumeration constants, and character constants
.

Immutable (constant) values should be declared as const-qualified objects (unmodifiable lvalues), macro definitions using #define, or enumeration constants.

...