Changes
Page history
Add Wiki for JPSvis
authored
Nov 14, 2014
by
Mohcine Chraibi
Show whitespace changes
Inline
Side-by-side
Code-Style-Conventions.markdown
0 → 100644
View page @
e9371ac5
# Code Style
Style we actually try to follow in JuPedSim
The code is formated using the automatic formatter
[
astyle
](
http://astyle.sourceforge.net/astyle.html
)
with the option
`--style=stroustrup`
> Stroustrup style formatting/indenting uses stroustrup brackets.
> Brackets are broken from function definitions only.
> Brackets are attached to everything else including
> namespaces, classes, and statements within a function, arrays, structs, and enums.
> This style frequently is used with an indent of 5 spaces.
Here is an
**example:**
```
javascript
int
Foo
(
bool
isBar
)
{
if
(
isBar
)
{
bar
();
return
1
;
}
else
return
0
;
}
```
## Tabs vs Spaces
this can be a long and religious discussion, to make it short
*DO NOT*
use tabs. Just spaces.
### Editors
Here some hints to configure your editor in order to use the
*stroustrup*
style
#### Emacs
Add this to you
```.emacs```
```
lisp
(
setq
c-default-style
"stroustrup"
c-basic-offset
5
)
(
setq
indent-tabs-mode
nil
)
```
#### Eclipse
-
Here is a
[
plugin
](
http://astyleclipse.sourceforge.net/
)
for astyle in eclipse.
-
[
How to change indentation width in eclipse?
](
https://superuser.com/questions/462221/how-do-i-reliably-change-the-indentation-width-in-eclipse
)
#### Vim
Set in your config file these variables
```
javascript
:
set
autoindent
:
set
cindent
:
set
expandtab
:
set
shiftwidth
=
5
:
set
softtabstop
=
5
```
## Comments
-
Comments and commit messages have to be written in english.
\ No newline at end of file