Re:The C++20 Naughty and Nice List for Game Devs
by loeg on Monday December 25, 2023 @12:28PM
(#38764371)
C++ compilers know when a structure is POD (plain old data) and could relax initialization order rules for them. I doubt they will.
Re:The C++20 Naughty and Nice List for Game Devs
by pjmlp on Monday December 25, 2023 @12:39PM
(#38764442)
And suddenly, after a small struct field change that invalidates POD rules, the code stops compiling, for example.
Re:The C++20 Naughty and Nice List for Game Devs
by loeg on Monday December 25, 2023 @12:56PM
(#38764588)
Sure, although making small edits thay break compilation isn’t all that unusual in C++. Eg, deleted constructors in added members, etc.
Re:The C++20 Naughty and Nice List for Game Devs
by flohofwoe on Monday December 25, 2023 @01:42PM
(#38764935)
extern "C" { ... } unfortunately only turns off C++ name mangling for symbols, it doesn't switch the C++ compiler into "C language mode". Such a feature would be incredibly useful though for mixing C and C++ code in the same source file.
Re:The C++20 Naughty and Nice List for Game Devs
by pjmlp on Monday December 25, 2023 @02:38PM
(#38765444)
Naturally, that was always its goal, extern "language" {} produces the same linkage model as language.
Even though many only know it with C, Fortran, Pascal and Ada were also common when C++ was gaining adoption.
It was never about being a polyglot compiler.
[0] https://gitlab.com/nbdkit/nbdkit/-/blob/cd761c9bf770b23f678f...