2,051
edits
Salty-horse (talk | contribs) m (→Whitespaces: whitespace) |
(some cleanup and typos) |
||
Line 5: | Line 5: | ||
We don't always follow these rules slavishly, in certain cases it is OK (and in fact might be favorable) to stray from them. Applying common sense, as usual, is a good idea. | We don't always follow these rules slavishly, in certain cases it is OK (and in fact might be favorable) to stray from them. Applying common sense, as usual, is a good idea. | ||
In the following examples tabs are replaced by spaces for visual consistency with the Code Formatting Conventions. But in actual code, use tabs for | In the following examples tabs are replaced by spaces for visual consistency with the Code Formatting Conventions. But in actual code, use tabs for indentations (our tabs are assumed to be 4 spaces wide). | ||
== Hugging braces == | == Hugging braces == | ||
Line 12: | Line 12: | ||
<pre> | <pre> | ||
for (int i = 0; i < t; i++) { | |||
[...] | |||
} | |||
if (j < k) { | |||
[...] | [...] | ||
} else { | } else { | ||
Line 20: | Line 24: | ||
class Dummy() { | class Dummy() { | ||
[...] | [...] | ||
} | }; | ||
</pre> | </pre> | ||
Line 95: | Line 99: | ||
'''Operator overloading''' | '''Operator overloading''' | ||
Operator keyword is NOT | Operator keyword is NOT separated from the name, except for type conversion operators where it is required. | ||
<pre> | <pre> | ||
struct Foo { | struct Foo { |
edits