News for hackers. Stuff that matters.
Re:Learning that you can use unions in C for grouping things... by cjaybo on Sunday August 01, 2021 @02:51PM (#28028824)
> C++ incompatibly requires a name for all struct and class declarations

You're right about "enum class", but anonymous classes and structs are perfectly valid in C++:

https://godbolt.org/z/7MbcqhnoK

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.
Re:Learning that you can use unions in C for grouping things... by midjji on Monday August 02, 2021 @03:32PM (#28041530)
gcc pedantic ignores the language flag, and clang and intel state they mirror gcc. So pedantic would be not C++11 even if you added that.
Re:Learning that you can use unions in C for grouping things... by dataflow on Sunday August 01, 2021 @05:05PM (#28029961)
Well that blows my mind, I never realized pedantic ignores the language setting. Is this the only case where it does that?