Changes

Jump to navigation Jump to search
m
Text replacement - "</source>" to "</syntaxhighlight>"
[...]
};
</sourcesyntaxhighlight>
Did you see the {}'s on that?
<source lang="cpp">
a = (b + c) * d;
</sourcesyntaxhighlight>
'''C++ reserved words separated from opening parentheses by a white space'''
<source lang="cpp">
while (true) {
</sourcesyntaxhighlight>
'''Commas followed by a white space'''
<source lang="cpp">
someFunction(a, b, c);
</sourcesyntaxhighlight>
<source lang="cpp">
int d, e;
</sourcesyntaxhighlight>
'''Semicolons followed by a space character, if there is more on a line'''
<source lang="cpp">
for (int a = 0; b < c; d++)
</sourcesyntaxhighlight>
<source lang="cpp">
doSomething(e); doSomething(f); // This is probably bad style anyway
</sourcesyntaxhighlight>
'''Mandatory ''{}'' for empty ''for''/''while'' loops'''
while (i < length - 1 && array[++i] != item); // bad
while (i < length - 1 && array[++i] != item) {} // good
</sourcesyntaxhighlight>
'''When declaring class inheritance and in a ? construct, colons should be surrounded by white space'''
<source lang="cpp">
class BusWheel : public RubberInflatable {
</sourcesyntaxhighlight>
<source lang="cpp">
(isNight) ? colorMeDark() : colorMeBright();
</sourcesyntaxhighlight>
'''Indentation level is not increased after namespace clause'''
} // End of namespace Scumm
</sourcesyntaxhighlight>
'''Array delete operator has no whitespace before []'''
<source lang="cpp">
delete[] foo;
</sourcesyntaxhighlight>
'''Template definitions'''
// ...
}
</sourcesyntaxhighlight>
'''Operator overloading'''
}
};
</sourcesyntaxhighlight>
'''Pointers and casts'''
<source lang="cpp">
const char *ptr = (const char *)foobar;
</sourcesyntaxhighlight>
'''References'''
int i = 0;
int &ref = i;
</sourcesyntaxhighlight>
'''Vertical alignment'''
x + w,
y + h);
</sourcesyntaxhighlight>
== Switch/Case constructs ==
Dialog::handleCommand(sender, cmd, data);
}
</sourcesyntaxhighlight>
* Note comment on whether fall through is intentional. Use exactly this and not some variation both for consistency and so that the compiler will see it and suppress potential warnings.
struct MyStruct { /* ... */ };
typedef int MyInt;
</sourcesyntaxhighlight>
'''Class member variables'''
<source lang="cpp">
char *_someVariableName;
</sourcesyntaxhighlight>
'''Class methods'''
<source lang="cpp">
void thisIsMyFancyMethod();
</sourcesyntaxhighlight>
'''Local variables'''
<source lang="cpp">
char *someVariableName;
</sourcesyntaxhighlight>
Note that for POD structures it is fine to use this rule too.
<source lang="cpp">
int g_someGlobalVariable;
</sourcesyntaxhighlight>
== Special comments ==
*/
virtual void warpMouse(int x, int y) = 0;
</sourcesyntaxhighlight>
(See [http://doxygen.scummvm.org/d9/df4/classOSystem.html#ecab84670def917107d6c1b5ca3b82c3 here] for the docs generated from this.)
int16 x; ///< The horizontal part of the point
int16 y; ///< The vertical part of the point
</sourcesyntaxhighlight>
(See [http://doxygen.scummvm.org/d7/d66/structCommon_1_1Point.html#2d868735aeaaf391ce9b3df9232c031f here] for the docs generated from this.)
TrustedUser
2,001

edits

Navigation menu