Python Guide: Exceptions are allowed but must be used carefully.
C++ Guide: Do not use lambda expressions, std::function or std::bind.
Python Guide: Okay for one-liners.
31–40 of 55 posts
Python Guide: Exceptions are allowed but must be used carefully.
C++ Guide: Do not use lambda expressions, std::function or std::bind.
Python Guide: Okay for one-liners.
Earlier quoted context omitted.
> 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.
I suspect they either use an STL that has a way to disable exceptions (such as STLPort) or they disable exceptions using compiler flags, or maybe both. You may argue that this really brings into question the "S" part of "STL" but it is done in practice and I'd argue it's not even all that difficult to deal with.
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.
The Google style guide could help explain why the Go team thought that their language would make more of an impact in C++ land than it actually did.
> Functions should start with a capital letter and have a capital letter for each new word. No underscores. Why so? It's Java-ish. Java favors camel notation for some historic reason. C++ on the other hand favors snake notation which is clearly reflected in stdc++. Snake notation is also easier to read, especially if the name contains many words in it. Of course in the end it's a matter of preference, I just wonder w…
Exactly. It's matter of preference. I can read TextLikeThis much easier than text_like_this. Granted I've been developing in C# for past few years so that's likely the reason.
> Functions should start with a capital letter and have a capital letter for each new word. No underscores. Why so? It's Java-ish. Java favors camel notation for some historic reason. C++ on the other hand favors snake notation which is clearly reflected in stdc++. Snake notation is also easier to read, especially if the name contains many words in it. Of course in the end it's a matter of preference, I just wonder w…
C++ Guide: We do not use C++ exceptions. Python Guide: Exceptions are allowed but must be used carefully. C++ Guide: Do not use lambda expressions, std::function or std::bind. Python Guide: Okay for one-liners.
It's similar to `gofmt` in the golang world, and is a really useful tool for enforcing these kind of style guides.
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.
> Rvalue references encourage a programming style that makes heavier use of value semantics. This style is unfamiliar to many developers, and its performance characteristics can be hard to reason about.
It's like, do you know C++ or don't you? Value semantics are C++.