相关疑难解决方法(0)

为什么C预处理器将单词"linux"解释为常量"1"?

为什么GCC中的C预处理器将单词linux(小写字母)解释为常量1

test.c的:

#include <stdio.h>
int main(void)
{       
    int linux = 5;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

结果$ gcc -E test.c(预处理阶段后停止):

....
int main(void)
{
    int 1 = 5;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

哪个 - 当然 - 会产生错误.

(顺便说一句:#define linuxstdio.h文件中没有.)

c linux gcc c-preprocessor

995
推荐指数
5
解决办法
11万
查看次数

标签 统计

c ×1

c-preprocessor ×1

gcc ×1

linux ×1