【发布时间】:2015-01-07 10:15:26
【问题描述】:
#include <iostream> gfhgfhgf
using namespace std;
int main() {
return 0;
}
为什么这段代码 sn-p 可以编译?根据The gcc reference on Include Syntax:
如果文件名后面的行有任何内容(除了 cmets),则为错误。
这正是代码中所做的。
【问题讨论】:
-
你的编译器是什么?我的 (
clang-600.0.51) 发出警告。 -
MSVC2013 预处理器语法也明确禁止它:msdn.microsoft.com/en-us/library/2scxys89.aspx
标签: c++ compiler-errors c-preprocessor