小编fel*_*322的帖子

为什么我不能在预处理器条件下使用sizeof?

我知道sizeof是一个运算符,它在编译时被计算为整数常量.但它似乎不能在#if预处理器指令中使用,如:

#if 4 == sizeof(int)
    typedef int Int32;
#endif
Run Code Online (Sandbox Code Playgroud)

(cygwin-gcc 3.4.4以及Visual C++ 6.0报告编译错误)

为什么不允许这样的使用?

c sizeof c-preprocessor

14
推荐指数
2
解决办法
5151
查看次数

标签 统计

c ×1

c-preprocessor ×1

sizeof ×1