What should I read to improve my style in C ++?

Possible Duplicate:
Ultimate Guide and List of Books in C ++

I have been developing in C / C ++ for quite some time (mostly C, which makes the style worse). So, I know how to use it. However, quite often I stuck with stylish solutions, such as: - should I return an error code here, throw exceptions, return an error through a parameter - should I have all this in the constructor or should I create a separate init function for it. etc.

Any solutions will work. However, each of them has minuses and pluses that I know and, most importantly, that I do not know.

It would be very nice to read something regarding the general style of development in C ++, coding practices, etc. What do you recommend?

+3
source share
5 answers

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

The ultimate guide and list of books in C ++

Read a few of them according to your level. This will definitely improve your coding style!

I personally would suggest you read:

  • Effective C ++ C ++ Series by Scott Meyers
  • Exceptional C ++ Series from Herb Sutter

Exceptional C ++ discusses exclusive code in depth. After reading this book, I learned how to design the effects of exclusion and the safety of classes and interfaces. Highly recommended!

+3
source

Many people have recommended this to me, and I have a copy. Effective C ++: 55 Concrete Ways to Improve Your Programs and Developments (3rd Edition) http://www.amazon.com/exec/obidos/ASIN/0321334876/christopherheng

+3

, : ++. / (, postfix _ ), .

"" . , , ++ ... "". , .

, . .

, , - Generic Programming STL. , , IS, , STL, ++. , , .

+2

, "Code Complete" Microsoft. , , . , .

if

if(nCheck = 1) {
    // will always do this because nCheck was assigned 0
}

if,

if(1 = nCheck) {
    // Now the compiler will catch the assignment as an error
}

Your code should help you by catching most of the simple syntax errors. This is just the tip of the iceberg. The book contains many such examples of smart practices that Microsoft has used over the years.

+1
source

For a better understanding of C ++ and style, I would recommend

  • Effective C ++ Series from Meyers
  • C ++ Frequently Asked Questions (BOOK) by Cline

Both are also "easy to read" due to the format of the small tablets.

0
source

Source: https://habr.com/ru/post/1790103/


All Articles