Macaw-Movies/Development/Code Rules: Difference between revisions
Line 12: | Line 12: | ||
=== Functions === | === Functions === | ||
* blank line before calling return | * blank line before calling <code>return</code> | ||
* blank line between two logical blocs | * blank line between two logical blocs | ||
=== Conditions === | === Conditions === |
Revision as of 13:31, 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; }