C++ supports a great variety of features. Likewise, one can be easily tempted to use it in many different ways or styles. Unfortunately, it doesn't suit many of them well - and thus becomes tedious, error-prone or slow if in such manner.
Or phrased differently, without really knowing what you do, it's incredibly easy to use C++ in a wrong way (which would much better supported in other languages). Plain learning by doing can therefore lead in a wrong direction - so reading good books is probably more important than in other languages (see this post on the same topic).
Java for example is an inherently object-oriented language. You can't program it much different that. In C++ however, you can. You can use it like you'd do in C or Java - and neither way is what C++ excels in, so you'd better stay with C or Java in these cases.
Therefore, you really need to know the proper style and idioms to get C++ right, right from the beginning. Unfortunately, they can be quite complex at first, but here are some - from simple to advanced.
- Don't worry about micro-optimizations (should I
inline a function,
- Refrain from using raw pointer or arrays wherever possible (especially
void*). Use references or smart pointers
- Write generic code = Understand templates
- Understand headers/code files/preprocessor (but avoid macros)
- Use the STL (and understand the underlying concepts)!
- Use boost
- Get your mind around object lifetime and scope - Manage RAII
- Don't write object-oriented code (i.e. lots of runtime polymorphism, inheritance) in the first place - there are much better OO languages out there
- Use objects instead
- Prefer static polymorphism
- Use compile-time functions