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

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



On Tue, Feb 04, 2014 at 08:17:05AM +0100, Thorsten Wißmann wrote:
>   - I'm too lazy to continue writing void everywhere.
>   - It looks totally ugly...
>   - I don't see how ignoring that and writing ambigous fkt() causes any
>     issues regarding security or stability. One will notice it if
>     parameters to a function are ignored.

But one might not immediately notice missing parameters to a
function, i.e. the caller forgot an argument.

> >  // core functions
> > -int quit() {
> > +int quit(int argc, char* argv[]) {
> >      g_aboutToQuit = true;
> >      return 0;
> >  }
>
> I really prefer the previous version, because in the other case there
> are parameters of that function which aren't used. Same for reload,
> true, false, etc.

But a reader immediately knows that the function takes arguments
which are at the moment unused. I find that clearer.

> Is there any advantage of writing (void), except that it is more
> "conform"?

See above. It's not a big advantage, but it's clearer and can
prevent problems in the future. And to me the void doesn't look
too bad, but that's a matter of opinion of course.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

Attachment: signature.asc
Description: Digital signature