Why is C++ difficult?

Like any programming language C++ has both advantages and disadvantages, and for certain tasks it’s an excellent choice.  If you’ve spent much time in online programming communities you may have seen people recommending beginners choose another language, often citing the difficulty of C++ as a major reason.  But is C++ really harder than other languages?  Why do people think that?  Difficulty is of course somewhat subjective — what some people find difficult will be easy for others, and vice versa — but we’ll try to stay reasonably objective.

C++ is complicated

C++ is a complex language which assumes that the programmer is an expert who knows what they are doing.  This provides great freedom and flexibility when the assumption is true, but means that there are many potential mistakes to be made which are more easily avoided or simply impossible in other languages.  Making it worse, thanks to the dreaded “undefined behaviour” there are many situations where the code will appear to work correctly but may cause subtle problems elsewhere or fail at a later time.  The C++ language is filled with undefined behaviour, obscure details, and unusual corner cases, and even programmers who have been using the language for years can sometimes be confounded by the language.   Consider for example these C++ quizzes.

C++ can be tedious

Thanks to a design goal of “only paying for what [features] you use” C++ code written by an expert programmer can be very efficient.  The trade-off for this is that you have to do a lot of work that other languages might handle for you; in cases when you don’t need that extra efficiency — which is more often than many beginners tend to think — this is simply a lot of extra work for no real benefit.  Manual memory management is a tedious and repetitive task  where mistakes can easily be made unless care is taken, and unless you’re on a platform with limited hardware capabilities or are writing particularly performance critical code there’s often minimal or no noticeable benefit from doing so; it might make you feel better to be that little bit more efficient, but customers won’t even notice the difference.

Other problems

There are a lot of poor-quality or outdated resources teaching “c with classes” under the guise of C++.

C++ is a difficult language to parse and has a rather dated build process.  This means that tools often aren’t as good as those available for other languages.