Live data from Hacker News

Google C++ style guide

google-styleguide.googlecode.com

1–10 of 55 posts

Re: Google C++ style guide

#2
"Vigorous programming is concise. A method should contain no unnecessary statements, a class no unnecessary methods, for the same reason that a drawing should have no unnecessary lines and a machine no unnecessary parts. This requires not that the programmer make all his methods short, or that he avoid all detail and treat his classes only in design, but that he make every statement tell."

—String and Wire (Elements of Modern Programming Style)

Re: Google C++ style guide

#3
No lambdas allowed? For many other things they say "use within reason", I don't see why they can't say this for lambdas. They're finally making the stl algorithms easily usable. You don't have to write Functors that are in a different place then called.

Also, the guide seems to completely miss templates and actually pretty much allow everything in C++ (except lambdas and exceptions). I don't really see the point then.

Re: Google C++ style guide

#4
It might sound like a good idea to precisely describe how code should be written, until you realize it's inefficient and useless.

Code coherence can be accomplished with more relaxed rules if you delegate more responsibility to your engineers.

Re: Google C++ style guide

#5
post #4

It might sound like a good idea to precisely describe how code should be written, until you realize it's inefficient and useless. Code coherence can be accomplished with more relaxed rules if you delegate more responsibility to your engineers.

> Code coherence can be accomplished with more relaxed rules if you delegate more responsibility to your engineers.

Please elaborate.

Re: Google C++ style guide

#6

No lambdas allowed? For many other things they say "use within reason", I don't see why they can't say this for lambdas. They're finally making the stl algorithms easily usable. You don't have to write Functors that are in a different place then called. Also, the guide seems to completely miss templates and actually pretty much allow everything in C++ (except lambdas and exceptions). I don't really see the point then…

They don't even want you to use rvalue references.

Re: Google C++ style guide

#7

No lambdas allowed? For many other things they say "use within reason", I don't see why they can't say this for lambdas. They're finally making the stl algorithms easily usable. You don't have to write Functors that are in a different place then called. Also, the guide seems to completely miss templates and actually pretty much allow everything in C++ (except lambdas and exceptions). I don't really see the point then…

> They're finally making the stl algorithms easily usable.

Well, considering they ban use of exceptions and considering that stl does use exceptions and therefore they cannot use stl, I don't think that they really care.

Re: Google C++ style guide

#10
The C++ you end up with by following Google's style guide is more of a "C with classes" thing, they prohibit several central features of C++. That said, I understand that they mostly do this to be consistent with their older code bases.

But it's not exactly a style guide I'd follow strictly in a new project/team.

Post reply on HN