3 ms·
C++ is somewhat bloat. We need a "C++ lite". We do this by moving features from C++ to C, bit-by-bits, until C become bloated.
by j16sdiz 3y ago
C++ is somewhat bloat.
We need a "C++ lite".
We do this by moving features from C++ to C, bit-by-bits, until C become bloated.
- pjmlp 3y agoC would do better improving what matters, the lack of safe enumerations, strings and arrays, but even that they fail to copy from C++.
- lebubule 3y agoYes, please better support for arrays, mainly multidimensional. Fortran is good for that. With good arrays I think that strings comes naturally.
- uecker 3y agoWhat is wrong with multi-dimensional arrays in C? It works far better than in C++: void foo(int X, int Y) { double a[X][Y]; .. } In fact, this is one reason I switched away from C++, because arrays are so bad in C++.
- pjmlp 3y agoThat is a CVE waiting to be exploited.
- uecker 3y agoNo.
- pjmlp 3y agoIt definitely is, given a nice combination of parameter values, stack sizes and careless programming.
- uecker 3y agoIt is not more unsafe than fixed-sized arrays on the stack and stack clash protection (which you need anyway) protects against this. Also if you compare with C++ and use std::vector, surprise, a CVE about to happen: https://godbolt.org/z/cTG71aTsf https://godbolt.org/z/cTG71aTsf (yes, one can activate library assertions, but still - by default - unsafe)
- abcd_f 3y ago> somewhat bloat ... is somewhat understatement.
- logicprog 3y agoIt's really frustrating to watch this happen, first with using arrays to mean non void pointers, then with _Generic for dispatching on types, and now this. And the worst part to me is not necessarily that they're complicating or "bloating" C, because these are necessary features, the worst part to me is that they seem to simultaneously recognize these features are necessary, and not want to commit to a full and proper implementation of them like e.g. proper generics or simple templates. Instead they create stuff like this, where they haven't fully committed and so it's weird and awkward to use and doesn't feel fully integrated into the language, with less clear semantics, so in the end it ends up kind of worse than C++, whereas what I wish they'd do, if they're going to bring features from C++ to C, is just fully and properly implement the feature, but make it as simple and limited and basic as possible — the basic concept of templates and monomorphization makes sense to me, buy I'm not exactly sure how this works at compile time. It this point, if I want generics, I'd rather just use C++.
- uecker 3y agoNote that a type system with polymorphic and dependent type system is far more powerful than generics or simple templates. In my opinion monomorphization is rather bad, because it creates a lot of compile time bloat while still not being very expressive from a type system point of view.