C:warning: missing whitespace after the macro name

[root@10 test]# gcc space.c
space.c:8:12: warning: ISO C99 requires whitespace after the macro name
#define abc/d
^

[root@10 test]# gcc -Wall -std=c90 space.c
space.c:8:12: warning: missing whitespace after the macro name
#define abc/d
^
这里是说缺少空格,宏名称后面如果还有其他字符,那么中间需要有空格。在语法上这个/将宏名称限定在之前。而且这个是除号的标识。所以不能用错

space.c: In function ‘main’:
space.c:9:12: error: expected expression before ‘/’ token
#define abc/d
^
space.c:17:79: note: in expansion of macro ‘abc’
printf("%s:timezone=%s, %s\n", program_invocation_short_name,tmp_tm.tm_zone, abc);
^~~

commit 1eb8a49836949a77c4f7d738786719e7fde0c333
Author: Masahiro Yamada <masahiroy@kernel.org>

你可能感兴趣的:(c/c++,c语言,开发语言)