Google Java Style Guide
return new MyClass() { @Override public void method() { if (condition()) { try { something(); } catch (ProblemException e) { recover(); } } else if (otherCondition()) { somethingElse(); } else { lastThing(); part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else or try/catch/finally). Example: void doNothing() {} 4.2 Block indentation: +2 spaces Each time a new block method reference (::), the amper- sand in type bounds (), and the pipe in catch blocks (catch (FooException | BarException e)). 2. When a line is broken at an assignment operator the break 0 码力 | 19 页 | 84.76 KB | 1 年前3Google Python Style Guide
exception for a module should be called Error. class Error(Exception): pass • Never use catch-all except: statements, or catch Exception or StandardError, unless you are re-raising the exception or in the out- except: will really catch everything including misspelled names, sys.exit() calls, Ctrl+C interrupts, unittest failures and all kinds of other exceptions that you simply don’t want to catch. • Minimize the0 码力 | 30 页 | 94.81 KB | 1 年前3Google C++ Style Guide
or final that is not an override of a base class virtual function will not compile, and this helps catch common errors. The specifiers serve as documentation; if no specifier is present, the reader has to callers. Either they must make at least the basic exception safety guarantee, or they must never catch the exception and be happy with the program terminating as a result. For instance, if f() calls g()0 码力 | 83 页 | 238.71 KB | 1 年前3
共 3 条
- 1