Yeah I agree that nobody could agree on a single subset of C++.
I think that Bjarne might mean "modern C++", but I'm more a fan of "C with classes", and I think the latter is more appropriate for many domains. I would say those are the two main dialects (with modern C++ being split being library writers using templates and library consumers.)
The old Google C++ style guide is good, but it seems to be morphing more into modern C++ lately. It's basically C with:
No exceptions, no IO streams (except in one place), no implicit constructors, no operator overloading, multiple inheritance, etc.
So I woudn't say there are 5 or 6 languages, but it definitely feels like that sometimes. I think the lack of a single string type, single error handling mechanism, and single deallocation mechanism are the things that make it feel like more than one language in a single codebase.
I agree, I'm definitely not a fan of the "Let's replace a simple and straightforward way with something that looks simpler at first but actually invokes a bunch of hidden complexity that's harder to debug and generates 10x more inefficient code. Why? Because that's the more 'modern' way." type of thinking I've seen from a lot of the "modern C++" advocates. They seem to be more interested in solving hypothetical or artificial problems that they themselves created, than the actual problem which needs to be solved.
Template libraries work well, until they don't, at which point you get many pages of confusing error messages containing absurdly long identifier names; and the cause is often something as simple as one missing, wrong, or extra character. Sometimes it even crashes the compiler...
Yes I've heard people remark that Go is basically Google's C++ style guide distilled into a new programming language... It's not 100% true but there's definitely some truth to it :)
Not having exceptions is a big similarity. Go slices and StringPiece are essentially the same idiom. There's a lot of vector<> and map<> which leads to builtin arrays and maps, rather than having arbitrary user-defined data structures (i.e. no operator overloading). gofmt was definitely inspired by Google's code review process.
I think that Bjarne might mean "modern C++", but I'm more a fan of "C with classes", and I think the latter is more appropriate for many domains. I would say those are the two main dialects (with modern C++ being split being library writers using templates and library consumers.)
The old Google C++ style guide is good, but it seems to be morphing more into modern C++ lately. It's basically C with:
- The ability to add methods to structs
- Basic single inheritance.
- Collection and string classes
- Scope based resource management.
https://stackoverflow.com/questions/3073642/official-c-langu...
No exceptions, no IO streams (except in one place), no implicit constructors, no operator overloading, multiple inheritance, etc.
So I woudn't say there are 5 or 6 languages, but it definitely feels like that sometimes. I think the lack of a single string type, single error handling mechanism, and single deallocation mechanism are the things that make it feel like more than one language in a single codebase.