Google C++ Style Guidedifferent meanings depending on whether the overload declaration is visible. Overloads of &&, ||, and , (comma) cannot match the evaluation-order semantics of the built-in operators. • Operators are often defined in a std::set, use a custom comparator rather than overloading <. 21 Do not overload &&, ||, , (comma), or unary &. Do not overload operator"", i.e. do not introduce user-defined literals. Type conversion overcome the downsides above, so they are allowed. When in doubt, use overloads. Trailing Return Type Syntax Use trailing return types only where using the ordinary syntax (leading return types) is impractical0 码力 | 83 页 | 238.71 KB | 1 年前3
Google Python Style Guideoften useful for cleanup, i.e., closing a file. • When capturing an exception, use as rather than a comma. For example: try: raise Error except Error as error: pass Global variables link Avoid global 2}, []) No: spam( ham[ 1 ], { eggs: 2 }, [ ] ) No whitespace before a comma, semicolon, or colon. Do use whitespace after a comma, semicolon, or colon except at the end of the line. Yes: if x == 4: print except for counters or iterators • dashes (-) in any package/module name • __double_leading_and_trailing_underscore__ names (reserved by Python) Naming Convention • “Internal” means internal to a module0 码力 | 30 页 | 94.81 KB | 1 年前3
Google's R Style Guideoptional when passing parameters in a function call. Do not place a space before a comma, but always place one after a comma. GOOD: tab.prior <- table(df[df$days.from.opt < 0, "campaign.id"]) total <- sum(x[ spaces around '<' tab.prior <- table(df[df$days.from.opt < 0,"campaign.id"]) # Needs a space after the comma tab.prior<- table(df[df$days.from.opt < 0, "campaign.id"]) # Needs a space before <- tab.prior<-table(df[df$days # Needs spaces around <- total <- sum(x[,1]) # Needs a space after the comma total <- sum(x[ ,1]) # Needs a space after the comma, not before Place a space before left parenthesis, except in a function0 码力 | 8 页 | 47.42 KB | 1 年前3
Google Java Style Guideor named class. For example, there is no line break after the brace if it is followed by else or a comma. Examples: return () -> { while (condition()) { method(); } }; return new MyClass() { @Override 3. A method or constructor name stays attached to the open parenthesis (() that follows it. 4. A comma (,) stays attached to the token that precedes it. Note: The primary goal for line wrapping is to Java operator precedence table memorized. 4.8 Specific constructs 4.8.1 Enum classes After each comma that follows an enum constant, a line break is optional. Ad- ditional blank lines (usually just one)0 码力 | 19 页 | 84.76 KB | 1 年前3
02 Scientific Reading and Writing - Introduction to Scientific Writing WS2021/22appropriate, or required to avoid ambiguity Lists: red, blue, black, and white (oxford/serial comma) Special sentence start: However, Hence, Therefore, In this paper, Semicolons Divide a long0 码力 | 26 页 | 613.57 KB | 1 年前3
共 5 条
- 1













