Most common complaint I have heard is that they ban the use of exceptions. Because of that they have a rule that says "avoid doing complex initialization in constructors" because "there is no easy way for constructors to signal errors, short of using exceptions (which are forbidden).".
I also read "Use streams only for logging". The motivation for this and for many other things do not make sense to most people. Streams are a very useful and easy to use. I don't see why people should not use them.
This guide probably works good for what Google is doing but it's not a general guide that makes the best use of C++ and everyone should use.
tbh I think arguing 1 companies coding style is a waste of time. As I said, I provided it as an example coding standard.
Coding standards are like religions, everyone has their own opinion and thinks theirs is the holy one.
I also do not consider the lack of exceptions to be bad written legacy code. There are many languages that do not provide exceptions that have written very successful large projects with very nice clean code. It's really a horses for courses scenario.
> tbh I think arguing 1 companies coding style is a waste of time.
Particularly when they themselves do not adhere to it strictly.
Not using exceptions implies that one has to use new( std::nothrow ) or malloc() followed by placement new to create objects with dynamic storage duration, standard containers or strings can't be used without first writing a custom (non-throwing) allocator, std::function<> can never be used without a preceding check for the existence of a target, any use of regular expressions (std::regex) and other portions of the standard library is forbidden and so on.
While "We do not throw exceptions from our code." would have been merely questionable, "We do not use C++ exceptions." is asinine.
> I also do not consider the lack of exceptions to be bad written legacy code.
Legacy or not, C++ code lacking exception awareness is abominable.
While C code lacking it is not. There is a not so subtle distinction between the two.
I'm tired right now, so I'll quickly slap together a list of some things you should consider, and maybe I'll edit this later on and actually be helpful :
•Do not use goto. Use loops instead.
•Do not use calls to system().
•Do not use usingnamespace std;. Especially in global scope.
If it's absolutely necessary for you to use it (which it never is), use it in the most localized scope.
•Avoid mixing std::cout with the '\n' character. For the sake of flushing and consistency you should be using std::endl;.