3 ms·
Well, you can slowly turn C in to C++... or you can just use a subset of C++. As a C++ fan, and to play devils advocate, the argument against CV-qualifier over
by nly 5y ago
Well, you can slowly turn C in to C++... or you can just use a subset of C++.
As a C++ fan, and to play devils advocate, the argument against CV-qualifier overloading is that it often results in code duplication. I.e. the implementation of both array_get's would be syntactically identical. In modern C++ you can avoid this by making "array*" a template parameter (T*), and let the compile deduce the return type for the function (use auto) from what you actually return.
Many C++ haters don't get that a lot of C++ features build on others.
- nuerow 5y ago> Well, you can slowly turn C in to C++... or you can just use a subset of C++. Those two are not the same. It requires far more expertise and experience to be able to strong-arm C++ into generating lean C-like code than just writing C and getting what you want right out of the box.
- nly 5y ago> It requires far more expertise and experience to be able to strong-arm C++ into generating lean C-like code than just writing C and getting what you want right out of the box. Even if that were true, and I protest that it isn't (I feel it's easier to generate good code in C++ than C), adding individual C++ features to C will just erode that ability to reason.