Re:Learning that you can use unions in C for grouping things...
by dataflow on Sunday August 01, 2021 @03:23PM
(#28029066)
Try
struct S { struct { int x; }; };
under -pedantic and you'll get warning: ISO C++ prohibits anonymous structs [-Wpedantic]
Re:Learning that you can use unions in C for grouping things...
by midjji on Sunday August 01, 2021 @04:57PM
(#28029893)
Pedantic is for the older C++ standard, its not pedantic for the latter e.g c++11, I think this changed.
Re:Learning that you can use unions in C for grouping things...
by junon on Sunday August 01, 2021 @05:21PM
(#28030116)
No, pedantic is for disabling compiler extensions. You still need to explicitly specify a standard.
You're right about "enum class", but anonymous classes and structs are perfectly valid in C++:
https://godbolt.org/z/7MbcqhnoK