Good C++ practices

Pages: 1234
Mar 24, 2014 at 10:21pm
OK, so at a point a person will not find anything new or interesting to learn in C++ but its quite helpful and worth the effort to adopt good C++ coding practices. There are many who don't know these, including myself. Therefore, I ask that if you know any, please list them. :)
Mar 24, 2014 at 10:40pm
I would start with Sutter/Alexandrescu's book "C++ Coding Standards" , although it doesn't go into too much detail.

And stay away from Google style guide if you want to be taken seriously.
Mar 24, 2014 at 10:46pm
There is a list of good ones at http://isocpp.org/wiki/faq/coding-standards . In fact, the whole FAQ could be shown as a 'Good Practices' guide, and goes in-depth with common questions and problems with C++ - I'd highly recommend that people take a look.
Mar 25, 2014 at 8:09am
Cubbi wrote:
And stay away from Google style guide if you want to be taken seriously.

What's interesting is that a few of their guidelines are in line with those given by the FQA.
"Don't use exceptions."
"Avoid initialization in constructors / use initialization member functions."

There are also some weird ones.
"Don't use lambdas."
"Don't use streams."
Mar 25, 2014 at 8:28am
closed account (z05DSL3A)
CERT C++ Secure Coding Standard:
https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=637
Mar 25, 2014 at 12:45pm
What's interesting is that a few of their guidelines are in line with those given by the FQA.

Yes, they're both trash. EC++ was even worse "don't use namespaces because we don't know what they are for", but I think nobody remembers it anymore.
Mar 25, 2014 at 1:45pm
Yeah sure. Google is such a pathetic company, all their projects fail spectacularly, they never made anything decent, nobody uses any of their shitty products. Its obvious they know nothing about programming.
Mar 25, 2014 at 2:51pm
Google is a great company, but their C++ style guide is an unfortunate disaster. Plenty of people who work there are very vocal about it, too.
Anyway, this thread was supposed to be about good practices.
Mar 25, 2014 at 3:52pm
closed account (iAk3T05o)
Almost everyone uses Google's products. Android is their product. Almost every non-i or windows phone uses Android OS. A lot of people use Google chrome. They created the first semi-self driving car. They are a great company :).
Last edited on Mar 25, 2014 at 7:52pm
Mar 25, 2014 at 4:24pm
Effective C++ by Scott Meyers
Mar 25, 2014 at 5:20pm
@ NT3: Interesting FAQ...the author has a sense of humour too. I like it xD.

@ Nathan2222: Being famous and an oligopolist in the software industry doesn't always necessarily mean that they are the best at programming ;).
Last edited on Mar 25, 2014 at 5:21pm
Mar 25, 2014 at 5:53pm
+1 Effective C++

Also, Code Complete by Steve McConnell. It isn't C++ specific, but I read it for the first time when I was doing an internship in college, and it drastically and immediately improved my software development ability.
Mar 25, 2014 at 6:25pm
@Nathan2222: If it's not obvious, I was being sarcastic.
Mar 25, 2014 at 7:12pm
closed account (iAk3T05o)
They aren't the best but they really good. Competition being apple, Microsoft and (is there any other?).
Sorry Abramus.
@stormboy: you are the first person i've seen that has admitted to learning C++ to the point that nothing is new or interesting. All i usually see is "i've been programming for a million years in c++ but i still consider myself at intermediate level".
Mar 25, 2014 at 9:20pm
You mean Google hasn't renamed it from Android since buying it in 2005? Figured by now they would have done something dumb like G-roid or something.
Mar 25, 2014 at 9:29pm
you are the first person i've seen that has admitted to learning C++ to the point that nothing is new or interesting
that depends on what you find interesting. i might find coding standards interesting but stormboy might not.

. All i usually see is "i've been programming for a million years in c++ but i still consider myself at intermediate level".
it would be arrogant to say otherwise. ive seen some of the most brilliant coders on here (for example disch) learn something new. i doubt that there are very many actual experts (i could be wrong however)
Mar 25, 2014 at 9:53pm
Being an expert does not mean you know 100% of something.
Mar 25, 2014 at 10:07pm
i never said it did
Mar 25, 2014 at 10:08pm
I could list a few good practices, but they're all in Effective C++, as the others have mentioned. Superb book.

You can get a second hand edition on Amazon for less that $1. Probably an older edition but still very valid.
Mar 25, 2014 at 10:08pm
@Little Bobby Tables
The only person that I think can say they are a master of C++ and get away with it would probably be Bjarne Stroustrup, but even then I'd doubt he would ever say he is. I've always said, I'm a student of many languages and master of none.
Pages: 1234