mirror of
https://github.com/systemd/systemd.git
synced 2025-03-13 00:58:27 +03:00
docs/CODING_STYLE: document that we nowadays prefer (const char*) for func ret type
Addresses https://github.com/systemd/systemd/pull/33567#discussion_r1662818225 (cherry picked from commit 4b7249111a4c1d366f476bdbd6e03f7893eb9d42)
This commit is contained in:
parent
ea92f16422
commit
3c91ea49d2
@ -54,6 +54,18 @@ SPDX-License-Identifier: LGPL-2.1-or-later
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Function return types should be seen/written as whole, i.e. write this:
|
||||||
|
|
||||||
|
```c
|
||||||
|
const char* foo(const char *input);
|
||||||
|
```
|
||||||
|
|
||||||
|
instead of this:
|
||||||
|
|
||||||
|
```c
|
||||||
|
const char *foo(const char *input);
|
||||||
|
```
|
||||||
|
|
||||||
- Single-line `if` blocks should not be enclosed in `{}`. Write this:
|
- Single-line `if` blocks should not be enclosed in `{}`. Write this:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
@ -182,7 +194,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
|
|||||||
|
|
||||||
```c
|
```c
|
||||||
static int foobar_frobnicate(
|
static int foobar_frobnicate(
|
||||||
Foobar* object, /* the associated mutable object */
|
Foobar *object, /* the associated mutable object */
|
||||||
const char *input, /* immutable input parameter */
|
const char *input, /* immutable input parameter */
|
||||||
char **ret_frobnicated, /* return parameter on success */
|
char **ret_frobnicated, /* return parameter on success */
|
||||||
unsigned *reterr_line, /* return parameter on failure */
|
unsigned *reterr_line, /* return parameter on failure */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user