tags:

views:

1155

answers:

4
+2  Q: 

C++ best practices

I thought I bookmarked a post on C++ best practices but I cannot seem to find it.

The title was something like, "10 things you should not do in C++", or something along those lines.

One recommendation was to not declare variables at the top of a function, but only when they are first needed.

Another was not adding parameters to constructors, but instead using inline initialization.

Can anyone point me to that post? Thanks.

+7  A: 

If you look for more in depth details about C++ best practices, I recommand the book "Effective C++" by Scott Meyers.

Michaël Larouche
Thanks for the suggestion. There was one specific post with 10 specific recommendations listed, it was a great reference. Hopefully someone recalls the post. But thanks for the book, I will check it out.
blu
+2  A: 

Could this link be the one you are referring to?

BTW, Bjarne Stroustrup (the creator of C++) also co-wrote a fantastic standards document with some folks at Lockheed Martin for the Joint Strike Fighter project. Regardless of what one thinks of military hardware, this document has a wealth of great "best practices" suggestions.

It can be found as a pdf at Bjarne's website.

Demi
No it is not, but it does have some interesting tips.
blu
+3  A: 

Check out "Coding Standards" by Sutter and Alexandrescu in addition to the Effective C++ recommendations.

nsanders
+1  A: 

IMHO, variables declaration is not only c++ specific recommendation, so probably you should familiarize with Code Complete by Steve McConnell. It contains a lot of language independent coding guidelines.

Eugene
Thanks for the suggestion on the book, but I am looking for a specific list.
blu