Recently, I'm working on changing some code of Chromium. When I try to use OTL+ODBC to connect mysql, I meet some problems. The OTL used lots of "try,catch,throw" phrases which cannot be used in Chromium Project according to the Google C++ style guide. Is there any method to enable to use them in Chromium?
Asked
Active
Viewed 76 times
1
-
1The style guide specifically allows exceptions to the rules when necessary to work with third party libraries. Although it's optional, an example would be using ``hMyHandle`` using WinAPI rather than ``my_handle``. – Pickle Rick Nov 01 '19 at 02:52
-
In addition to @PickleRick's comment, an exception to a style guide is not "enabled". It is something that is justified in the context of a project and signed off by someone (like a program manager) who has authority and responsibility to manage the risk of such decisions. Note, however, that use of "lots of "try,catch,throw" is considered bad practice in C++ by more than the Google style guide for several reasons. I suggest serious consideration of either rewriting the code in question to not use exceptions and/or consider using another means to access the databases. – Peter Nov 01 '19 at 09:17
-
To clarify Peter's comment: C++ uses RAII. Unlike many other languages, cleanup isn't handled by a `catch` but by a destructor of an object going out of scope. `throw` isn't a problem in normal C++. (Google is known for its outdated C++ guide) – MSalters Nov 01 '19 at 09:54