3 ms·
> Things that matter are for example that C++ has vectors or other container types with the possibility to enable bounds checking with a compile flag. As I men
by tom_mellior 6y ago
> Things that matter are for example that C++ has vectors or other container types with the possibility to enable bounds checking with a compile flag.
As I mentioned above, templated containers is the one significant C++ feature that GCC uses. So maybe you now agree that it's not just C compiled as C++ after all?
- deleted 6y ago[deleted]
- jstimpfle 6y agoWell I was never going into a "technically" argument, I thought that was pretty clear from the start. I had already knewn that those containers are used there in some places (although I didn't find any when I quickly skimmed the codebase 2 days ago). So let's just say "yes technically I agree" and maybe I won't seem as a totally boneheaded evangelist. My actual intention and the reason for my comments was to put things into relation. Compared to what you want to argue about here, pjmlp has a totally different idea of how things are or should be, and which I think is rose tinted and skewed. Using a templated container once maybe every few dozen or hundred lines is not a justification for unfounded and unbalanced hating, and it is no indication for taking this codebase as an argument that C is so bad that they couldn't deal with it anymore, so they had to switch to C++ which solved all their alleged problems. That's just not the way it is. Not taking from that technical point of agreement, and as an aside because I can't resist, I personally prefer to just use stay with C completely/"technically", and I believe I get better results by improving the architecture of my projects to work around C's "shortcoming" of not having templated containers. One can even make a point that just templated dynamic vectors are easily available in C since C does have polymorphism for arrays, supported by its pointer syntax, and using valgrind and the occasional assert() you can get lots of the same benefits in terms of security. The way I go about this achieves the same level of convenience, minus RAII (which I found to be problematic on larger scale. Templated containers and maps are nice though for short throw away code and temporary variables that never leave the function scope.) I also actually make heavy use of a C99 feature that is still not in C++, which is designated initializers to make static arrays (often readonly data) to map from enums to additional data. I also found that I've wasted a lot of my time trying to build arbitrary "nice" things in C++ and always finding myself in a place some time later where I've totally locked myself in, so that's why I prefer just not to use a C++ compiler at all, even if there are some little nice-to-haves that you can get with it. So there you go, my rant that is totally out of place here, why I don't think C++ is a better choice even if used very lightly.