Browse Source

Update 'SingOS_Coding_Practice.md'

master
Jakob Galle Kjær-Kammersgaard 5 years ago
parent
commit
bad2c10a8b
1 changed files with 51 additions and 2 deletions
  1. +51
    -2
      SingOS_Coding_Practice.md

+ 51
- 2
SingOS_Coding_Practice.md View File

@ -2,7 +2,7 @@
*Version 1 -- A first draft at formalizing a common coding practice for SingOS Development*
## On naming in general
## On naming
We encourage long but descriptive identifier names like,
@ -49,4 +49,53 @@ but with parameter names in all-caps:
## On indentation
We use 4 spaces per indent, at least in C-style languages. (^:
We use 4 spaces per indent, at least in C-style languages. (^:
## On brace-placement
What do we prefer?
This:
if (something)
{
do_stuff();
}
else
{
this_other_thing();
}
Or this:
if (something) {
do_stuff();
}
else {
this_other_thing();
}
## On return statements
We prefer an explicit else case even though a return was found in an above branch:
if (some_condition)
{
return "Olga";
}
else
{
return "Finn";
}
As opposed to:
(BAD)
if (some_condition)
{
return "Olga";
}
return "Finn";
(BAD)

Loading…
Cancel
Save