3 ms·
> What kitchen sink was thrown in C++? What wasn't? - Procedural programming - Structures and enumerations - Overloading of functions, including operators
by Silhouette 16y ago
> What kitchen sink was thrown in C++?
What wasn't?
- Procedural programming
- Structures and enumerations
- Overloading of functions, including operators
- Classes, object-oriented programming and run-time polymorphism
- Generic programming, templates, compile-time polymorphism and metaprogramming
- Text-based macros
- Hacks and, from C++0x, built-in language support for in-line functions
- Exceptions
- Low-level memory access
By my count, every one of those things interacts with almost every other one in some way. Often, there are deep connections, such as the RAII idiom, that are fundamental to using C++ effectively but not obvious to someone with a good general programming background but no expertise in C++ specifically.
The real problem, though, is that C++ isn't really very good at any of those things in isolation. There are much better approaches to all of them, and there are tools available that take those approaches. They just don't fit together to form a coherent whole, where features are either orthogonal or blended together cleanly. It used to be the case that C++ offered a more powerful overall tool than most other languages because of the diversity of its features, but today's languages have had the benefit of decades more experience and hindsight to draw on. The very diversity that used to be a compelling reason to use C++ has now become the most compelling reason not to, IMHO.
- kenjackson 16y agoLets be clear... half of your list is from C: -Procedural programming -Structures and enumerations -Text based macros -Low-level memory access And for the items they actually added to C to make C++, none of them are all that unusual, save templates (not sure if there is any other language that does it compile time). IMO, Scala has more parts of the sink in it than C++. The problem with C++ isn't the kitchen sink. It's that its built on a language that isn't meant to hold the things that C++ would like to add to it. Maybe I'm being pedantic, but when I see "kitchen sink" I have a vision of a lot of features. But frankly C++ isn't all that feature rich. But its the interaction complexity that makes it problematic. This is not a problem of throwing the kitchen sink at it, but rather a design problem.
- hga 16y agoLet's put it this way: do you know of any successful C++ project of serious size that doesn't specify and stick to a subset of the language?
- kenjackson 16y agoSeveral that I've worked on. There were aspects of the language that we avoided, like export, because they weren't implemented. But in general, we didn't have ground rules about features to use or not use. At least not in the past 15 years. Back in '93ish we would be more careful, because the features were still evolving, but by 2002-2003 I don't think we had a lot of issue using the language.