对于像这样的函数
int test(void) { static int x = 0; x++; return 0; }
C 编译器允许优化吗x?
x
作为参考,GCC 6.3.0 或 Clang 3.9 都没有优化使用x-O3 的增量。
c static local compiler-optimization
c ×1
compiler-optimization ×1
local ×1
static ×1