In shell scripts, functions do not have a return type
do_shell_stuff() {
}
Bad C code
On the other hand, in C, the return type of a function is crucial to the understanding of the function and surrounding code. The function is non severable from its return type. Thus lines like the following are non-sensical:
static int
do_c_stuff(void()
{
}
While I suspect there is a desire to write functions this way for consistency with bash code, I find this to be stupid. It detracts readability because:
It increases the number of lines of code
It requires more cognitive effort to understand the function
Preferred C code
It is always preferable do declare the function in a single line. If that can be done, it is the only way to do it.
static int do_c_stuff(void)
{
}
When this does not fit on a single line (80 characters according to the kernel coding guidelines), it is okay to mode the static and/or inline keyword on a separate line. In any case the return type must be on the same line as the function.
In shell scripts, functions do not have a return type
Bad C code
On the other hand, in C, the return type of a function is crucial to the understanding of the function and surrounding code. The function is non severable from its return type. Thus lines like the following are non-sensical:
While I suspect there is a desire to write functions this way for consistency with bash code, I find this to be stupid. It detracts readability because:
Preferred C code
It is always preferable do declare the function in a single line. If that can be done, it is the only way to do it.
When this does not fit on a single line (80 characters according to the kernel coding guidelines), it is okay to mode the static and/or inline keyword on a separate line. In any case the return type must be on the same line as the function.
Issue
A lot of code in realtek-poe uses the "Bad C code" style. This must be refactored.