__builtin_constant_p

int __builtin_constant_p (exp);

You can use the built-in function __builtin_constant_p to determine if a value is known to be constant at compile-time and hence that GCC can perform constant-folding on expressions involving that value. The argument of the function is the value to test. The function returns the integer 1 if the argument is known to be a compile-time constant and 0 if it is not known to be a compile-time constant. A return of 0 does not indicate that the value is not a constant, but merely that GCC cannot prove it is a constant with the specified value of the '-O' option.

 

Constant folding is the process of recognizing and evaluating constant expressions at compile time rather than computing them at runtime.

你可能感兴趣的:(Const)