... | ... | @@ -271,9 +271,8 @@ Important rules, and notable differences are summarized here: |
|
|
|
|
|
|
|
|
## General Rules
|
|
|
- Don't use ```using namespace ;``` or ```using symbol``` in a header file to inject alien definitions into the "corsika::" namespace (if not absolutely and fundamentally necessary). Do this only inside local scope, e.g. functions.
|
|
|
- Only include headers that you need. If you remove functionality, also remove header files! Include header files as local as possible.
|
|
|
- Basically never use "iostream" cout, cerr, and endl. We use our own logging machinery based on spdlog!
|
|
|
|
|
|
- Basically never use "iostream" cout, cerr, and endl. We use our own logging machinery based on spdlog.
|
|
|
- Test your code with ```-pedantic``` compiler flag enabled.
|
|
|
- Warnings have to be fixed, when they appear on the system(s) currently used by the CI, by altering the code unless the warning originates from third-party code and cannot be fixed. In such cases, developers of the third-party project should be informed. Should the warning be locally silenced, either using appropriate pragmas or locally turning off warnings for that translation unit, documentation should be added in the entry point triggering the
|
|
|
warning using the flag ```"FIXME"``` as keyword.
|
... | ... | @@ -331,26 +330,29 @@ warning using the flag ```"FIXME"``` as keyword. |
|
|
- C header files ends with ".h" and source files with ".c"
|
|
|
|
|
|
|
|
|
## CMAKE formatting
|
|
|
|
|
|
- command are lower cases, e.g. ```set (...)```
|
|
|
- variables upper case, e.g. ```set (VAR1 Text)```
|
|
|
|
|
|
Since cmake itself lacks structure almost entirely:
|
|
|
- put a space between command and start of parenthesis, e.g. ```command (...)```
|
|
|
- add two spaces for logical indent
|
|
|
```
|
|
|
if (condition)
|
|
|
do something
|
|
|
endif (condition)
|
|
|
```
|
|
|
- break long lines to start with new keyword in new line (indented)
|
|
|
```
|
|
|
install (
|
|
|
FILES ${CORSIKAstackinterface_HEADERS}
|
|
|
DESTINATION include/${CORSIKAstackinterface_NAMESPACE}
|
|
|
)
|
|
|
```
|
|
|
- add plenty of comments to all cmake code
|
|
|
- use expressive variables and functions
|
|
|
## CMake formatting
|
|
|
|
|
|
Look at existing CMake file to get an impression on the style we use.
|
|
|
|
|
|
- command are lower cases, e.g. ```set (...)```
|
|
|
- variables upper case, e.g. ```set (VAR1 Text)```
|
|
|
|
|
|
Since CMake itself lacks structure almost entirely:
|
|
|
|
|
|
- put a space between command and start of parenthesis, e.g. ```command (...)```
|
|
|
- add two spaces for logical indent
|
|
|
```
|
|
|
if (condition)
|
|
|
do something
|
|
|
endif (condition)
|
|
|
```
|
|
|
- break long lines to start with new keyword in new line (indented)
|
|
|
```
|
|
|
install (
|
|
|
FILES ${CORSIKAstackinterface_HEADERS}
|
|
|
DESTINATION include/${CORSIKAstackinterface_NAMESPACE}
|
|
|
)
|
|
|
```
|
|
|
- add plenty of comments to all CMake code
|
|
|
- use expressive variables and functions
|
|
|
|