Macaw-Movies/Development/Code Rules: Difference between revisions
Appearance
Line 15: | Line 15: | ||
* blank line between two logical blocs | * blank line between two logical blocs | ||
== Conditions == | |||
The following rules sould be followed (1 space after key word, 1 between condition and curly bracket). | The following rules sould be followed (1 space after key word, 1 between condition and curly bracket). | ||
{{Input|<syntaxhighlight lang="cpp-qt" line> | {{Input|<syntaxhighlight lang="cpp-qt" line> |
Revision as of 13:32, 23 April 2015
Naming
- English is used for all names (class, function, variable…)
- camelCase is used for all names
Variables
- Abreviations are not tolerated anywhere in the code. All names must be as explicit as possible
- members start with
m_
- local variables start with
l_
- function parameter names do not have a specific prefix
- global variables are prohibited, the few accepted are capitalized
- class names start with a capital letter
Functions
- blank line before calling
return
- blank line between two logical blocs
Conditions
The following rules sould be followed (1 space after key word, 1 between condition and curly bracket).
if (variable > 0) { ...do something... } else if (variable == 0) { ...do something else... } else { ...do something else... }
If there is more conditions to fulfill:
if (cond1 & cond2) { ...do something... }
For the switch/case:
switch (var) { case 1: fct(); break; case 2: otherFct(); break; }