Sourcecode Indention
- Use space for indention (no tabs)
- Block indention is 4 spaces
- No space after parenthesis
- No space after function names
- No line break before braces
Example:
void foo(float x, float y) {
if (x > y) {
bar(x);
} else {
bar(y);
}
}
Naming Conventions
Classes are named Lsg<real class name>. Class names start with a capital letter. If multiple words form a class name, they are combined with every word starting with a capital letter.
Class methods are named <Classname>_<method name>. Method names start with a lower-case letter. If multiple words form a method name, all except the first start with a capital letter.
Examples:
- Classes
- Methods
- LsgObject_destroy
- LsgNode_display
- LsgList_hasNext
Classes
Classes mostly consist of two files, a header and a source file. Extremely large classes my use more than one source file. The filenames should not contain the lsg prefix.
The header file defines the class structure and all non-static function prototypes. For any virtual method that is not overriden, a define mapping the method to the parent classes implementation, should be included.