3 ms·
C++'s name mangling feels like a dealbreaker to me; it really hurts interoperability with other languages. In general, C feels well-suited to be the language t
by EvilTerran 14y ago
C++'s name mangling feels like a dealbreaker to me; it really hurts interoperability with other languages.
In general, C feels well-suited to be the language that (almost) every other language can talk to; C++ just doesn't fit that role so well.
- Erwin 14y agoYou can explicitly export functions you want available outside, disabling the name mangling (using export "C"). I'm not sure how else you think C++ could handle its goals without the name mangling: overloading and compatibility with C's linker system. If you have two overloaded "foo" functions you need to somehow designated them as separate linker symbols. C has similar problems of its own: like what's the calling convention for the exported symbol? Do I push the arguments on the stack, and who cleans up? Do some arguments go into registered? Where does the return value go? What's the layout of a struct? All things are platform, compiler and compiler configuration dependent. What other languages, that compile to object files or shared objects, that support the level of OO features etc. that C++ has, have a well-defined ABI?