2,599
edits
Efernandez (talk | contribs) |
Efernandez (talk | contribs) |
||
Line 12: | Line 12: | ||
In general, if you are adding code to an existent code, be consistent with the coding standard already being used. If no standard is used then follow this guide. | In general, if you are adding code to an existent code, be consistent with the coding standard already being used. If no standard is used then follow this guide. | ||
=== Comments === | === Comments === | ||
Line 70: | Line 60: | ||
One single empty line is fine to separate logical blocks. Avoid multiple empty lines, commented empty lines, etc. | One single empty line is fine to separate logical blocks. Avoid multiple empty lines, commented empty lines, etc. | ||
== Naming == | |||
=== File names === | |||
Filenames should be all lowercase and can include underscores (_) or dashes (-). Follow the convention that your project uses. If there is no consistent local pattern to follow, prefer "_". | |||
<syntaxhighlight lang="c++"> | |||
my_useful_class.cc | |||
my-useful-class.cc | |||
</syntaxhighlight> | |||
=== Variable naming standard === | === Variable naming standard === | ||
Line 117: | Line 118: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Conditionals == | |||
*Keep the constants at the left side of a comparisons. This applies to all [https://en.cppreference.com/w/cpp/language/operator_comparison C++ comparison operators]. For example: | *Keep the constants at the left side of a comparisons. This applies to all [https://en.cppreference.com/w/cpp/language/operator_comparison C++ comparison operators]. For example: |