我想保留任何其他检查-Wpedantic,但会丢失有关未命名结构的警告error: ISO C++ prohibits anonymous structs [-Wpedantic].
我希望能够做到以下几点:
union
{
struct
{
float x, y, z, w;
};
struct
{
float r, g, b, a;
};
float v[4];
};
Run Code Online (Sandbox Code Playgroud)
我正在使用C++ 11并使用-std=c++11标志进行编译.我已经读过C11支持这个功能,但我还没有看到它在C++ 11中得到支持.
我曾经提到过-fms-extensions:
我尝试了旗帜,它似乎没有任何效果(无论在-fms-extensions和之间排序的排列-Wpedantic).
感谢我的评论,我发现了以下内容:
我仍然想知道是否有一种方法可以启用此gcc扩展(我知道所有编译器都有)将禁用该警告.或者是-Wpedantic全有还是全无?
我在C++标准文档中读到了关于类的内容:
类是一种类型.它的名称在其范围内成为类名(9.1).
Run Code Online (Sandbox Code Playgroud)class-name: identifier template-id
我在C++标准中找到了这个标识符的语法:
2.10 Identifiers
identifier: nondigit
identifier nondigit
identifier digit
nondigit: one of universal-character-name
_ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
digit: one of 0 1 2 3 4 5 …Run Code Online (Sandbox Code Playgroud)