We know that indentation style is a personal matter but the codebase needs to look consistent, so please adhere to the conventions below.
int
vs const std::vector<SomeVeryLongTypeName>&
).if
, for
, while
, return
, and other keywords=
, ==
, &&
, ||
, and other operatorsreturn
statements//
not /**/
The OMNeT++ IDE provides you pre-configured code styles in Window -> Preferences -> C++ -> Code Style. Choose OMNeT++ as your code style. Pressing Ctrl+Shift+F will reformat your code to match this style.
Rules for variable names, function names, class names, and other identifiers.
is
or has
//
comments for consistency with NED and MSG files.//
comments in the code (except for Doxygen comments)========
, --------
or ########
Consistent layout of class declarations throughout the project helps maintainers to remain sane.
/** */
) for public API only//
comments//
comments where necessaryMisnamed and “kitchen-sink” functions are unfortunately quite common and make the code hard to follow and reason about. Here’s what you can do:
//
comment above each block to document its intended purposeMost users of INET are not C++ scholars. We think the codebase should be written in a style and in a subset of C++ that makes it accessible to our users.
From INET 3.0, the following C++11 features will be allowed (and recommended):
auto
for iteratorsnullptr
static_assert
for
loopsfinal
method keywordoverride
method keyword