Table of Contents
The following are guidelines that have generally been followed in libSBML code. Not every piece of code adheres to them but we are trying to move to a point where the code is as consistent as possible.
The following are the main issues.
Do not be afraid of whitespace
- Indentation should be in multiples of 2 spaces
- Line length should never exceed 80 columns
- There should be 2 blank lines between each function definition in a header file
- There should be 2 blank lines between each function in a code file
Good |
Bad |
|
|
Function code
- Curly brackets should have their own line
- Any return statement should be on a separate line
- Bracket sub-code to illustrate scope
- Leave blank lines between distinct bits of code
- Line up similar notation e.g. equals signs
- Leave spaces around operators/keywords
Good |
Bad |
|
|