constant_computer_programming

Constant (computer programming)

“In computer programming, a constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant. (Note: In some cases the expectation of constancy can be circumvented, e.g. using self-modifying code or by overwriting the memory location where the value is stored.) When associated with an identifier, a constant is said to be a “named,” although the terms “constant” and ”named constant“ are often used interchangeably. This is contrasted with a variable, which is an identifier with a value that can be changed during normal execution, i.e., the value is variable. Constants are useful for both programmers and compilers: for programmers they are a form of self-documenting code and allow reasoning about correctness; while for compilers they allow compile-time and run-time checks that constancy assumptions are not violated, and allow or simplify some compiler optimizations.”

Fair Use Source: Constant (computer programming)

Categories

constant_computer_programming.txt · Last modified: 2024/04/28 03:17 (external edit)