Why can't I use sizeof in a preprocessor condition?

爷,独闯天下 提交于 2019-11-27 15:29:58

Because sizeof is evaluated at compilation time while directives are evaluated before compilation, and the part that does that is not the compiler, so it won't understand what sizeof means.

The sizeof is a C operator. You can't use C code in preprocessor directives. Preprocessor directives are evaluated before the compilation takes place.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!