Re:Algorithms for Modern Hardware
by throwaway2037 on Sunday March 17, 2024 @03:10AM
(#39732516)
The latest version the Google C++ Style Guide of says: "We do not use C++ exceptions."
Ref: https://google.github.io/styleguide/cppguide.html#Exceptions
They do have that rule, but not for performance reasons. The full decision is here https://google.github.io/styleguide/cppguide.html#Exceptions and probably worth a read but the two main take away I think is:
> Because most existing C++ code at Google is not prepared to deal with exceptions, it is comparatively difficult to adopt new code that generates exceptions.
Re:Algorithms for Modern Hardware
by tsimionescu on Sunday March 17, 2024 @06:51AM
(#39733460)
I see noexcept as a part of the language that works together with exceptions, it is a valid optimization for certain (typically small) pieces of a code base that otherwise uses exceptions.
I'd imagine when people say "not using exceptions", it is about using compiler flags to completely disable the exception mechanisms from the language. And this also invalidates many of the design patterns C++ is known and sometimes praised for, at least RAII and operator overloading.
But most people using it in industry fall into two camps:
1. using it because the project is old enough that C++ was a reasonable default when the project started. You may also be right here
2. using it because performance is absolutely critical to the application, here I would actually imagine you're wrong. noexcept removes a ton of stack-unwinding code, and you can absolutely get a significant performance boost out of it. It would be weird if they didn't pull this lever, given the perf boost and that errors as values is also a fairly reasonable way to handle problem
In the second category, google famously had a "no exceptions" rule at one point (could still be in effect, I have no knowlegde of google)