mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
docs: update coding style for return (void) func(...)
Seems that people think it's useful for brevity so make it explicit in the CODING_STYLE.
This commit is contained in:
@@ -318,6 +318,14 @@ layout: default
|
||||
unlink("/foo/bar/baz");
|
||||
```
|
||||
|
||||
When returning from a `void` function, you may also want to shorten the error
|
||||
path boilerplate by returning a function invocation cast to `(void)` like so:
|
||||
|
||||
```c
|
||||
if (condition_not_met)
|
||||
return (void) log_tests_skipped("Cannot run ...");
|
||||
```
|
||||
|
||||
Don't cast function calls to `(void)` that return no error
|
||||
conditions. Specifically, the various `xyz_unref()` calls that return a
|
||||
`NULL` object shouldn't be cast to `(void)`, since not using the return value
|
||||
|
||||
Reference in New Issue
Block a user