Google does not use exception in their C++ code base. For errors, they use a class called status than the programmer must check when it is returned from a function. Otherwise the program does not compile (link https://www.youtube.com/watch?v=NOCElcMcFik at 41:34). I have a few questions:
1) Is there any example of that class on the web freely available?
2) That's okay for "void f()" that work with side effects that you turn into a "Status f()". But what if your function already returns a value? Google does not allow to pass references that are not const so you can't mutate a Status object given to you. So how do they do?
Thanks for your help.
From Google style guide:
Input parameters are usually values or const references, while output and input/output parameters will be non-const pointers.
As the lecturer said Google uses a proprietary in-house compiler that has been rigged to throw errors when Status
isn't checked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With