[MPlayer-dev-eng] [PATCH] Automatic downmix

Diego Biurrun diego at biurrun.de
Wed Sep 8 19:59:23 CEST 2010


On Wed, Sep 08, 2010 at 07:46:27PM +0200, Nicolas George wrote:
> [ This is quite off-topic; I'll shut up after this message. ]

C coding is not offtopic on mplayer-dev-eng.

> Le duodi 22 fructidor, an CCXVIII, Diego Biurrun a écrit :
> > It's the C standard that requires it, actually.  'void' denotes a
> > parameterless function, while an empty parameter list denotes a
> > variable list of parameters.
> 
> That makes it legal. It is a matter of coding style whether to accept it or
> not.

We don't and we even enabled the gcc warning for it: -Wstrict-prototypes.

> Although, I think it is more complicated than that. C99 says:
> 
> # An empty list in a function declarator that is part of a definition of
> # that function specifies that the function has no parameters. The empty
> # list in a function declarator that is not part of a definition of
> # that function specifies that no information about the number or types
> # of the parameters is supplied.
> 
> As I understand this paragraph, "void foo();" declares foo with a
> variable/unspecified list of parameters, but "void foo() { something }"
> defines foo with an empty list of parameters, just like "void foo(void) { }".

That's how I read it as well, it's somewhat puzzling..

> C99 also says:
> 
> # The use of function declarators with empty parentheses is an obsolescent
> # feature.
> 
> But I am not sure whether that means that "void foo()" will be illegal or
> equivalent to "void foo(void)" like it is in c++.

Let's just settle on avoiding it.

Diego


More information about the MPlayer-dev-eng mailing list