Re: [PATCH *-next 00/18] Remove weird and needless 'return' for void APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025/2/21 21:02, Zijun Hu wrote:
> void api_func_a(...);
> 
> static inline void api_func_b(...)
> {
> 	return api_func_a(...);
> }

The Usage : Return void function in void function

IMO, perhaps, the usage is not good since:

A) STD C does not like the usage, and i find GCC has no description
about the usage.
   C11/C17: 6.8.6.4 The return statement
   "A return statement with an expression shall not appear in a
function whose return type is void"

B) According to discussion, the usage have function that return type
   of the callee api_func_a() is monitored. but this function has below
shortcoming as well:

the monitor is not needed if the caller api_func_b() is in the same
module with the callee api_func_a(), otherwise, provided the callee is
a API and provided by author of other module. the author needs to clean
up lot of usages of the API if he/she changes the API's return type from
void to any other type, so it is not nice to API provider.

C) perhaps, most ordinary developers don't known the function mentioned
   by B), and also feel strange for the usage




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux