1. __builtin_constant_p
它是GCC的内建函数,用于判断一个值是否为编译时常数,如果参数是常数,函数返回 1,否则返回 0。
#include <stdio.h> #define MAX 10 //built in constant int global = 10; //non built in constant int * const p = NULL; //non built in constant int test_func() //non built in constant { return 0; } void main() { if (__builtin_constant_p(p)) { printf("built in constant\n"); } else { printf("non built in constant\n"); } }
标签:__,non,constant,built,int,汇总,GCC,杂项 From: https://www.cnblogs.com/hellokitty2/p/16928628.html