Search code examples
c++coding-style

What should I read to improve my C++ style


I was developing for quite long time already on C/C++ (mostly C, which makes style poorer). So, I know how to use it. However, quite often I stuck with style decisions like: - should I return error code here, throw exceptions, return error through a parameter - should I have all this stuff in constructor or should I create separate init function for that. and so on.

Any solutions WILL work. However, each of them has cons and pros, which I know and most importantly which I don't know.

It would be very nice to read something regarding overall C++ development style, coding practices and so forth. What do you recommend?


Solution

  • Here is a list of really good books on C++:

    The Definitive C++ Book Guide and List

    Read few of them as per your level. That would most certainly improve your coding style!

    I would personally suggest you to read:

    • Effective C++ series C++ by Scott Meyers
    • Exceptional C++ series by Herb Sutter

    Exceptional C++ discusses exception-safe code in-depth. After reading this book, I learned how exception-safety effects design of classes, and interfaces. Highly recommended!