Use (void) for empty function parameters
I just happened to notice that these are the only three C functions that don't take any arguments and use () instead of (void) in their definition.
Ah, it looks like the webp functions are like that to get rid of the warning. They should actually have two parameters to match the PyMethodDef declaration, but if those parameters were added there would be a warning due to them being unused.
but if those parameters were added there would be a warning due to them being unused.
Can't you just use unnamed parameters to get rid of the warning?
It looks like the solution in other places is just to cast it to the right type.
What is the benefit of (void) over ()? It's just a stylistic choice right, to try and more clearly communicate that there are no arguments?
If this is the general agreement, then sure, go ahead - but to me, requiring casting is a step too far for just a style preference.
Casting is already used for this reason quite a lot elsewhere already. By "other places" I meant "other places in Pillow"; I wasn't talking about other projects.
https://github.com/python-pillow/Pillow/blob/c250a44177ac1e82d300aef702d5c2feef15fd03/src/_webp.c#L530-L536
https://github.com/search?q=repo%3Apython-pillow%2FPillow+%28PyCFunction%29&type=code
Casting is already used for this reason
None of those castings involve functions that have (void) for their parameters.
The WEBP functions were removed in #8213, so it's just the one JPEG function now.
What is the benefit of (void) over ()? It's just a stylistic choice right, to try and more clearly communicate that there are no arguments?
They technically have different meanings in C. func(void) means "this function does not take any arguments", while func() means "this function takes an undefined number of arguments of undefined types". I believe I saw this come up as a warning somewhere when compiling, but I don't remember where, or what flags I might have enabled.