4 ms·
I think a lot of people would argue that many C++ features, like OO, are not strictly improvements. Also C++ is a massive language, and part of the beauty of C
by skohan 7y ago
I think a lot of people would argue that many C++ features, like OO, are not strictly improvements. Also C++ is a massive language, and part of the beauty of C is it's simplicity.
I think what a lot of people would want is something which maintains that simplicity, but mainly delivers on basic QOL lessons we've learned in the past 40 years, like that it's nice not to have to pass around array lengths as separate variables.
- kllrnohj 7y ago> I think a lot of people would argue that many C++ features, like OO, are not strictly improvements. Sure, but D has those OO features, too, so that's an argument against both, not one. > like that it's nice not to have to pass around array lengths as separate variables. -betterC doesn't have dynamic arrays, though. That's one of the "unavailable features" currently. But that's also sommething C++ solved as well - std::vector does exist, after all, as does move semantics to avoid copying it unnecessarily. C++ is far from perfect, of course, but D's -betterC doesn't really fix any of C++'s issues and it doesn't retain C's simplicity. It's in an awkward middle ground between the two - is that really a viable place to be? For users that already know & have C++ codebases, what's the sales pitch here? For existing C users, what does -betterC do that hasn't already been done and already failed to attract the C holdouts?
- pjmlp 7y agoOne thing that D does better and that on C++ depends pretty much on the team and which compiler toolchain you use, bounds checking for strings and arrays. You can get them in C++, and VC++ does it by default on debug code, but not all compilers do by default and it isn't required by the standard unless you explicitly make use of the at() variants. On the other hand, every attempt to bring bounds checking to C has failed, lets see how far Microsoft goes with Checked C.
- Shorel 7y agoYou don't have to use all of C++ everywhere when programming C++. In particular, I really love that I seldom use operator new. Objects are instantiated in the stack and object creation is ridiculously fast.
- WalterBright 7y ago> part of the beauty of C is it's simplicity. True, but the trouble with simplicity is a number of things become excessively tedious and error-prone to code - such as ensuring no buffer overflows. C makes up for its lack of expressivity by adding a text preprocessor. The preprocessor is a tacit admission that the core language simply isn't powerful enough. When people find themselves doing metaprogramming with the C preprocessor, it's really time to graduate to a more powerful language. DasBetterC doesn't need a preprocessor, and its metaprogramming facilities far outstrip the C preprocessor.
- maxsam 7y ago> its metaprogramming facilities far outstrip the C preprocessor. ...and are severely crippled by applying betterC constraints to CTFE: // CTFE-only string genint(string name) { return "int " ~ name ~ ";"; } void main() { mixin(genint("x")); } Error: array concatenation of expression "int " ~ name ~ ";" requires the GC which is not available with -betterC