c/language/constant expression

Several varieties of expressions are known as constant expressions

Preprocessor constant expression
The expression following #if or #elif must expand to
 * other than, , , or whose arguments are preprocessor constant expressions
 * s
 * s
 * the special preprocessor operator

Character constants, when evaluated in -expressions, may be interpreted in the source character set, the execution character set, or some other implementation-defined character set.

Integer constant expression
An integer constant expression is an expression that consists only of
 * other than, , , or , except that operators can only cast arithmetic types to integer types
 * s
 * s
 * s, but only if they are immediately used as operands of casts to integer type
 * operators
 * operators

Integer constant expressions are evaluated at compile time. The following contexts require expressions that are known as integer constant expressions:
 * The size of a.
 * The value of an
 * The label of a
 * The size of a array
 * Integer to pointer implicit.

Static initializer
Expressions that are used in the of objects with static and thread_local  must be expressions that may be one of the following

@1@ arithmetic constant expression, which is an expression of any arithmetic type that consists of
 * other than, , , or , except that operators must be converting arithmetic types to other arithmetic types
 * s
 * s
 * s
 * operators
 * operators

@2@ the null pointer constant null @3@ address constant expression, which is
 * a null pointer
 * designating an object of static or a function designator, converted to a pointer either
 * by using the unary address-of operator
 * by casting an integer constant to a pointer
 * by array-to-pointer or function-to-pointer implicit

@4@ address constant expression of some complete object type, plus or minus an integer constant expression @5@ constant expression of one of the other forms accepted by the implementation.

Unlike with integer constant expressions, static initializer expressions are not required to be evaluated at compile time; the compiler is at liberty to turn such initializers into executable code which is invoked prior to program startup.

The value of a floating-point static initializer is never less accurate than the value of the same expression executed at run time, but it may be better.

Floating-point constant expressions
Arithmetic constant expressions of floating-point types that are not used in static initializers are always evaluated as-if during run-time and are affected by the current rounding (if FENV_ACCESS is on) and report errors as specified in.