考虑这个无害的 C++ 程序:
#include <iostream>
int main() {
std::cout << "(Is this a trigraph??)" << std::endl;
return 0;
}
当我使用 g++ 5.4.0 版编译它时,我得到以下诊断:
me@my-laptop:~/code/C++$ g++ -c test_trigraph.cpp
test_trigraph.cpp:4:36: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
std::cout << "(Is this a trigraph??)" << std::endl;
^
程序运行,其输出如预期:
(Is this a trigraph??)
为什么要为三元组解析字符串文字?
其他编译器也这样做吗?