News for hackers. Stuff that matters.
Re:The C++20 Naughty and Nice List for Game Devs by flohofwoe on Monday December 25, 2023 @08:52AM (#38762576)
It's not just the random initialization order that didn't make it from C99 into C++, other features also don't work, most notably:

...no chaining of designated initializers:

   const bla_t bla = { .a.b.c = 23 };
...and no array indexing:

   const blub_t blub = {
       .arr = {
           [4] = 23,
           [2] = 1
       }
   };
...all those limitations taken together, and the C++ designated initialization feature is pretty much useless except for the most trivial structs - while in C99, designated initialization really shines with complex, nested structs.

The funny thing is that none of those limitations would be required. Clang had supported full C99 designated init in C++ mode just fine for many years before C++20 appeared.

Re:The C++20 Naughty and Nice List for Game Devs by calamari4065 on Monday December 25, 2023 @11:40AM (#38763948)
Oh man, I've desperately wanted both of these features in basically every language I've used.

I think you can do a similar sort of array initialization in C#, but definitely not chained initializers. Those are both so useful, but I can see why they aren't included in C++/++

Re:The C++20 Naughty and Nice List for Game Devs by loeg on Monday December 25, 2023 @12:27PM (#38764363)
> all those limitations taken together, and the C++ designated initialization feature is pretty much useless except for the most trivial structs

We find it pretty useful even with the limitations. Certainly not “pretty much useless.”