[英](Di|Tri)graphs in C++11
After reading up on digraphs and trigraphs I went on and tested a simple program: 阅读完有向图和三向图后,我继续测试了一个简单的程序:
#include <stdio.h>
int main()
{
int a = 0;
//??/
++a;
printf("%d",a);
return 0;
}
and by reflex I did 通过反射我做到了
g++ -std=c++11 test.c
and to my surprise no warnings were emitted and 0 was printed so I went on and tried compiling with the C compiler and it did emit a warning due to the trigraph. 令我惊讶的是,没有发出警告,并且打印了0,所以我继续尝试使用C编译器进行编译,但由于三字组合,它的确发出了警告。
My question is why does -std=c++11
automatically pull in -trigraphs
and emit no warning by default ? 我的问题是,为什么
-std=c++11
在默认情况下会自动拉入-trigraphs
发出警告? (without using -Wall) Do implementations of certain C++11 features require them? (不使用-Wall)某些C ++ 11功能的实现是否需要它们? (highly doubt it but worth asking)
(高度怀疑,但值得询问)
Passing -std=c99
has the same effect of enabling the trigraph and disabling the warning. 传递
-std=c99
具有与启用Trigraph和禁用警告相同的效果。
It must enable the trigraph to be strictly standard-compliant. 它必须使Trigraph严格符合标准。 Disabling the warning is surprising, but note that the warning is about a trigraph being ignored .
禁用警告是令人惊讶的,但是请注意,警告是关于三字母组合被忽略的情况 。 The warning probably goes away because
-std
failed to activate separate warnings ( -Wtrigraphs
) about a trigraph being used . 该警告可能消失了,因为
-std
无法激活有关正在使用的三字字母的单独警告( -Wtrigraphs
)。
And that should probably be considered a bug. 那可能应该被认为是一个错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.