Which is the most hated C++ feature that C++ programmers can't avoid using?
closed as not constructive by Aaronaught, Walter, Mark Trapp Jul 2 '11 at 8:20
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
I have learned to hate implicit conversions in every form. In the long run, they are a PITA and not worth at all the 'simplifications' they offer. Having to type a few characters more is well worth the added clarity of code. Yet, I have to deal with all built-in ones and those (knowingly and unknowingly) added by class designers. |
|||||
|
|
I am no C++ expert, but this is what I find problematic: Preprocessor Directives Why? When header guard name collisions happen, they lead to hard to understand errors for which the compiler typically provides worse than useless diagnostics. |
|||||||||||||||||||||
|
|
For me, easily the fact that pointers are a type but the syntax makes it look like a property of the variable name.
creates two ints. Great!
creates ... an int pointer and an int. WTF?!? Thus good practice is to associate the pointer with the variable name, like so:
Just plain stupid. |
|||||||||||||||||
|
|
None. Seriously, I can't think of a C++ feature that would be both (1) hated and (2) unavoidable. As C++ is a language with which many different paradigm can be used, many of its features can be avoided: you don't have to use the STL, you don't even have to write classes (although you're then mostly back to C, etc. |
|||||
|
|
I'm not an expert, but I find it very hard using string manipulation/processing libraries. |
|||||||||||||||||
|
|
The C bit. Unfortunately that's the best bit too. Clarification. Bad
Good
|
|||||
|
|
Header files. What's the point? |
|||||||||||||
|
|
Uninitialized memory It's crazy that variables and memory allocations can have random data in them. I hate when programs behave non-deterministically. |
|||||||||||||||||||||
|
|
The whole single-dispatch class-crap. I much prefer how LISP-style "classes" [CLOS] work (in a nutshell: multiple-dispatch 'methods' as freestanding functions). |
|||||
|
|
Several:
|
||||
|
|
|
Exceptions. I'm not arguing against them, it's just that they exist, and most programmers ignore them, but buying into them has a ripple effect that most programmers don't want to even think about. Example: floating point exceptions. Does your code handle them explicitly? What happens if it doesn't? Edit: Overly optimistic statement corrected. |
||||
|
|
I loathe that, its not nice, its not big and its not clever. Its only there because it was in C, and I think it was broken in C too. The compiler could easily have determined the type of the variable being deleted and free the entire array rather than the first element - especially as the array variable is (obviously) a pointer and the compiler already knows the size to delete. |
|||||
|
|
I only worked with C++ briefly in the 90's and i would have to say multiple inheritence. combining several unrelated objects into one and still have a logical and consistent interface to it was too mind bogling for me. I'm much happier with single inheritence with interfaces. |
|||||||||||||||||
|
|
From what I learnt, using unnecessary templates can make debugging hell. But they are required for abstraction. |
|||||
|
|
Templates. For me they are C++ incarnation of C strings; the idea in principle is nice, but they:
|
|||||||||||||||||||||
|
|
Pointer and reference idiosyncrasy. I found to have to think extra hard tO figure out if a reference or a pointer is most appropriate. |
|||||
|
|
Inheritance should have been better thought I think. There are C++ performance losses due to multiple inheritance. I don't really know what compromises there could have been on the C++ language, or what could replace class inheritance, but sometime I wonder if is has such a good purpose. When thinking about the KISS principle, templates and high level class usage makes me wonder... |
||||
|
|
|
The fact that C and C++ are very different languages. |
||||
|
|
+1from me! – sbi Dec 12 '10 at 9:22