Conversation

can someone tell me why c++ compilers don't checksum class layouts to let the linker warn you if you've fucked up ABI compatibility? ocaml does this, works well
Quote Tweet
the answer is that i forgot to pass an option to my code generator, so half of the compiled code used one (up to date) class definition inline in the source file and the other half of the compiled code used another (outdated) class definition in the header file infuriating
Show this thread
8
77
Replying to
The biggest reason, I guess, is inability to reliably handle all the madness C++ ABI can conjure. Hell, you can break ABI without even changing class layout. My favorite example of this is making TrivialType class non-trivial.
1
Replying to
Not in the sense of ABI compatibility though. Compilers produce *some set of bytes* that *most often* works as expected, but sometimes still blows everything up. AFAIK there are no ABI analysis tools whatsoever (on the level where you check if ABIs for two _source_ files match).
2
I did hit an issue where enabling -ftrivial-auto-var-init=zero caused a minor change that broke the checks and I had to regenerate the ABI information. The failure was a very minor issue and I just applied a very blunt fix for the problem since this isn't relevant to us anyway.
1
2
Show replies