[PATCH 01/10] Use void as "parameter" for functions without arguments.

Simon Ruderich simon at ruderich.org
Wed Feb 5 20:51:04 CET 2014


On Wed, Feb 05, 2014 at 03:22:57PM +0100, Thorsten Wißmann wrote:
> This won't ever happen. When calling a function like »void quit()«, you
> can't forget to pass a parameter. And if you change the signature to
> something else the compiler will complain if the caller forgets an
> argument.

Of course, you're right. I got confused, sorry.

> Well actually quit does not expect arguments, only after applying your
> patch. It does not care about arguments at all and needs none, but
> passing arguments to it does not cause trouble. That's what () is
> saying and what is happening here. It is OK to use quit as a command
> but it is also OK to call quit() directly without passing anything.

True.

But the way these functions are called, it should expect
arguments.

> Well to me it looks bad, and it seems that language designers prefer an
> empty argument list "" to encode "does not need/expect/take any
> arguments" and not "void" (or something similar). It's just a hack in C.

Well, yeah. But that's just how it works in C.

But I don't care that much and if you don't like the patch, don't
apply it. I'd prefer the "correct" solution which specifies which
functions take no arguments, but if you don't, that's fine by me.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://listi.jpberlin.de/pipermail/hlwm/attachments/20140205/841592e4/attachment.asc>


More information about the hlwm mailing list