C++ is a great language, but it would be a much better language if it would just abandon C already. I mean, sure, maintain the ability to bind to C libraries and other sorts of machine-code level integrations, just stop with backwards compatibility at the language level.
So what change would you like to see that maintains...
I mean, sure, maintain the ability to bind to C libraries and other sorts of machine-code level integrations
...that degree of ABI compatibility, while...
just stop with backwards compatibility at the language level.
...somehow achieving this? What, exactly, would you like to drop?
A lot of people complain about C arrays being no more than pointers. Sure, that could be dropped from C++, but you no longer get to binary link against C libraries.
Mostly, I'd love to see header files and preprocessing macros go away.
I'd also love stronger typing -- C plays really loose with typing.
Basically I want C# from a general namespacing/scoping standpoint, but with C++ allocation semantics and runtime libraries, native compiliation by default, and functions as first class citizens.
I'd also love stronger typing -- C plays really loose with typing.
C++ already has stronger typing than C. What, exactly, do you want changed about C++ in this regard? And how is it supposed to be binary compatible with C?
You've tossed out some very attractive buzzwords -- stronger typing! we all want stronger typing! -- but you've given no specific examples, nor indication that you understand that these are very nearly impossible to implement while also still linking against native C.
It's possible to bake a lot of information into name mangling, so it's very likely that stronger link-time analysis could be performed when linking C++ with other C++. That would be possible (with some trade-offs that not everyone would necessarily enjoy), and things like that already have been done, and continue to improve. But doing that when linking against C, nope.
The C++ standards people (who would also be the ones implementing the compilers and linkers and libraries) recognize that binary compatibility with C is simultaneously C++'s biggest strength and its biggest weakness. If they could have let you eat the cake and keep it too, it would have already been done. (I know this because I was one of those people for a time.)
Basically I want [a bunch of stuff that can't happen without breaking the ABI, and no suggestions as to how this would possibly happen].
You'd have to change C as well to get any of that. In fact, you'd have to change it so much that it wouldn't be binary compatible with older versions of itself. At that point, you might as well just do a new language yourself, implement what features you want, and name it after your favorite beer/taco/bourbon/moon.
Don't name it Beer Taco Bourbon Moon, though. That would be weird.
OP wanted to link against C libraries. So, that's the degree of compatibility required.
Less frivolously, C/C++ binary compatibility has always been per-platform, not necessarily cross-platform. It should link with other stuff on the same kind of system, not necessarily stuff on some unknown.
C++ with its "every compiler use different name mangling" is the opposite of binary compatibility.
What do you mean with C already? The big problem with C++ is the foothold it has with C, for instance all the crap that people have to program to get rid of all the C++ headers in C. The guy who organized that kind of organization to start with should have been "getting rid of" a long time ago. Here, why can a CPP program being called .cc or .cpp, but not .hh? Why does it still has to be called .h?
39
u/systemadvisory Jan 22 '19
Whatever, C++ is dope, haters gonna hate :)