Re: [PATCH *-next 00/18] Remove weird and needless 'return' for void APIs
From: Zijun Hu
Date: Mon Mar 03 2025 - 06:30:53 EST
On 2025/2/27 21:03, Peter Zijlstra wrote:
>> C) perhaps, most ordinary developers don't known the function mentioned
>> by B), and also feel strange for the usage
> It is quite common to do kernel wide updates using scripts / cocinelle.
>
> If you have a specialization that wraps a function to fill out a default
> value, then you want the return types to keep matching.
>
> Ex.
>
> return_type foo(type1 a1, type2 a2);
>
> return_type my_foo(type1 a1)
> {
> return foo(a1, value);
> }
>
> is a normal thing to do. The whole STD C cannot return void bollocks
> breaks that when return_type := void, so in that regards I would call
> this a STD C defect.
The usage is a GCC extension.
but the usage is prone to be used within *inappropriate* context, take
this patch series for an example:
1) both foo() and my_foo() are in the same module
2) or it seems return type void is the best type for foo(). so no good
reason to track its type.