4 ms·
i write C++ every day (i actually like it...) but absolutely no one is going to switch from C to C++ just for dtors.
by mathisfun123 8mo ago
i write C++ every day (i actually like it...) but absolutely no one is going to switch from C to C++ just for dtors.
- Pay08 8mo agoWeren't dtors the reason GCC made the switch?
- uecker 8mo agoI don't think so. As a contributor to GCC, I also wished it hadn't.
- Pay08 8mo agoWhy do you think so?
- uecker 8mo agoFor two reasons: First, where C++ features are used, it make the code harder to understand rather than easier. Second, it requires newer and more complex toolchains to build GCC itself. Some people still maintain the last C version of GCC just to keep the bootstrap path open.
- Pay08 8mo agoI'm very far from compiler development, but in my experience, while C++ is hard to read, the equivalent C code would be much more unreadable.
- uecker 8mo agoThis is not my experience at all. In fact, my experience is where C++ is used in GCC it became harder to read. Note that GCC was written in C and then introduced C++ features later so this is not hypothetical. In general, I think clean C code is easier to read than C++ due to much less complexity and not having language features that make it more difficult to understand by hiding crucial information from the reader (overloading, references, templates, auto, ..).
- kibwen 8mo agoNo, RAII is one of the primary improvements of C++ over C, and one of the most ubiquitous features that is allowed in "light" subsets of C++.
- flohofwoe 8mo ago> but absolutely no one is going to switch from C to C++ just for dtors The decision would be easier if the C subset in C++ would be compatible with modern C standards instead of being a non-standard dialect of C stuck in ca. 1995.
- gpderetta 8mo agoOf course not! Those that would have, already did!