| Topic | Rule |
|---|---|
| Indenting | spaces, not tabs |
| Maximum line length | not fixed (although above 100 is considered long) |
Names are always written in CamelCase style. Not in underscore_style. The only exceptions are defines (include guards / macros).
| Topic | Rule | Example |
|---|---|---|
| Local variables | Variables start lower case, even if they start with an acronym. | double someVariable Station umtsStation |
| Methods | Methods start lower case. They describe an action. Therefore, they should contain a verb. NVI is prefixed with do, event-based interface with on | void sendData() void doSendData() void onData() |
| Classes | Classes start with an upper case letter and are written in CamelCase | class PositionProvider |
| Interfaces | Interfaces start with an I | class IComponent |
| Class members | End with an underscore | int bar_ |
| Namespaces | Namespace are written all in lowercase letters | namespace wns using namespace wns::simulator |
| Template | Template parameters are written in | template <typename KEY, typename VALUE> |
| Parameters | upper case letters | |
| Macros | Marcos are written in upper case letters. Underscores should be used for better readability. | #define WNS_ADD(x, y) (x)+(y) |
| Include Guards | Include guards, like Macros, are written in upper case letters with underscores to enhance readability | MODULE_DIR_SUBDIR_SUBSUBDIR_FILE #ifndef CP_CONGESTION_TAHOE_HPP |