Update 'Coding Style'
parent
2aa9f8cd1d
commit
08dc3cd0b9
1 changed files with 34 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="400" src="https://code.hlrs.de/hpcpvogl/BigWhoop/raw/branch/main/docs/img/Heading.png" alt="BigWhoop Document Headline">
|
<img width="400" src="https://code.hlrs.de/hpcpvogl/BigWhoop/raw/branch/main/docs/img/Headline.svg" alt="BigWhoop Document Headline">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
|
@ -38,19 +38,43 @@ Above all, the following rule from the GNOME developer documentation should alwa
|
||||||
## Formatting
|
## Formatting
|
||||||
Keep the length of source code lines to 100 characters or less to ensure maximum readability on most modern monitors with a reasonable font size. Longer lines of code are more difficult to read and understand. Too many indentations should be interpreted as an indication that code restructuring is required.
|
Keep the length of source code lines to 100 characters or less to ensure maximum readability on most modern monitors with a reasonable font size. Longer lines of code are more difficult to read and understand. Too many indentations should be interpreted as an indication that code restructuring is required.
|
||||||
### Indentation
|
### Indentation
|
||||||
|
Each new level is indented by 2 spaces, braces go on a line by themselves, and they are indented as well:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
while ((c = *str++))
|
while ((c = *str++))
|
||||||
{
|
{
|
||||||
if ((c >= 97) && (c <= 122))
|
if ((c >= 97) && (c <= 122))
|
||||||
{
|
{
|
||||||
c = c - 32;
|
c = c - 32;
|
||||||
}
|
}
|
||||||
hash = (hash * 33) ^ c;
|
hash = (hash * 33) ^ c;
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
Continuation lines should align wrapped elements either vertically using Python’s implicit line joining inside parentheses, brackets and braces, or using a hanging indent [1]. When using a hanging indent the following should be considered; there should be no arguments on the first line and further indentation should be used to clearly distinguish itself as a continuation line:
|
||||||
|
```c
|
||||||
|
error = initialize_tagtree(&prec_control->tag_inclusion,
|
||||||
|
prec_control->numCbX,
|
||||||
|
prec_control->numCbY,
|
||||||
|
prec_control->numCbZ,
|
||||||
|
prec_control->numCbTS)
|
||||||
|
exit(error);
|
||||||
|
```
|
||||||
|
```c
|
||||||
|
error = initialize_tagtree(
|
||||||
|
&prec_control->tag_inclusion,
|
||||||
|
prec_control->numCbX,
|
||||||
|
prec_control->numCbY,
|
||||||
|
prec_control->numCbZ,
|
||||||
|
prec_control->numCbTS);
|
||||||
|
exit(error);
|
||||||
```
|
```
|
||||||
### Braces
|
### Braces
|
||||||
|
```c
|
||||||
|
prec_control->numCodeblocks_a = (uint64)(prec_control->numCbX
|
||||||
|
* prec_control->numCbY
|
||||||
|
* prec_control->numCbZ
|
||||||
|
* prec_control->numCbTS);
|
||||||
|
```
|
||||||
### Functions
|
### Functions
|
||||||
### Derived Types
|
### Derived Types
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue