Constant Expressions

From RAD Studio
Jump to: navigation, search

Go Up to Constants Overview Index

A constant expression is an expression that always evaluates to a constant (it is evaluated at compile-time and it must evaluate to a constant that is in the range of representable values for its type). Constant expressions are evaluated just as regular expressions are. You can use a constant expression anywhere that a constant is legal. The syntax for constant expressions is:

constant-expression:
Conditional-expression

Constant expressions cannot contain any of the following operators, unless the operators are contained within the operand of a sizeof operator:

  • Assignment
  • Comma
  • Decrement
  • Function call
  • Increment

See Also