Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
JPSvis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JuPedSim
JPSvis
Wiki
Code Style Conventions
Changes
Page history
New page
Templates
Clone repository
Add Wiki for JPSvis
authored
10 years ago
by
Mohcine Chraibi
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code-Style-Conventions.markdown
+57
-0
57 additions, 0 deletions
Code-Style-Conventions.markdown
with
57 additions
and
0 deletions
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
This diff is collapsed.
Click to expand it.