int __builtin_constant_p (exp)函数的使用

来源:互联网 发布:淘宝脐橙如何分类 编辑:程序博客网 时间:2024/06/05 07:24

 int __builtin_constant_p (exp)是GCC内置函数

功能:

— Built-in Function: int __builtin_constant_p (exp)

You can use the built-in function __builtin_constant_p todetermine if a value is known to be constant at compile time and hencethat GCC can perform constant-folding on expressions involving thatvalue. The argument of the function is the value to test. The functionreturns the integer 1 if the argument is known to be a compile-timeconstant and 0 if it is not known to be a compile-time constant. Areturn of 0 does not indicate that the value isnot a constant,but merely that GCC cannot prove it is a constant with the specifiedvalue of the-O option.


也就是说在编译时,只要exp参数是常数,就返回1,否则返回0.


原创粉丝点击