Google C++ Style Guide• Overuse of operators can lead to obfuscated code, particularly if the over- loaded operator’s semantics don’t follow convention. • The hazards of function overloading apply just as much to operator over- overload declaration is visible. Overloads of &&, ||, and , (comma) cannot match the evaluation-order semantics of the built-in operators. • Operators are often defined outside the class, so there’s a risk of pointer is not a possible value. References can be confusing, as they have value syntax but pointer semantics. Within function parameter lists all references must be const: void Foo(const string &in, string0 码力 | 83 页 | 238.71 KB | 1 年前3
Google Python Style Guidereading the function’s code. A docstring should describe the function’s calling syntax and its semantics, not its implementation. For tricky code, com- ments alongside the code are more appropriate than should be listed as *foo and **bar. Returns: (or Yields: for generators) Describe the type and semantics of the return value. If the function only returns None, this section is not required. Raises: List potential incompatibility with Python 3000. It also defines special methods that implement the default semantics of objects including __new__, __init__, __delattr__, __getattribute__, __setattr__, __hash__, __repr__0 码力 | 30 页 | 94.81 KB | 1 年前3
共 2 条
- 1













