[MPlayer-dev-eng] [PATCH] libbs2b audio filter

Uoti Urpala uoti.urpala at pp1.inet.fi
Fri Mar 6 15:07:07 CET 2009


On Fri, 2009-03-06 at 12:50 +0300, Andrew Savchenko wrote:
> On Thursday 05 March 2009 19:55, Uoti Urpala wrote:
> > > Why? It isn't fast definitely, but it should work anyway if
> > > number and type of arguments will be compatible with those
> > > declared in the function prototype of actually called
> > > function.
> >
> > You are _not_ calling it with compatible argument types. If you
> > were then you could declare the function pointer with those
> > correct types and there would be no warnings.
> 
> And there is NO warnings, just test it )).

I didn't mean there would be warnings now. I meant that if the arguments
actually were compatible then you could declare them properly and there
_still_ wouldn't be warnings.

> > You are calling it 
> > with a "void *" second argument, while the actual functions have
> > incompatible argument types like "float *" or "short *". You can
> > give a void * as a parameter to a function that has been
> > declared to take any pointer type because the compiler allows
> > automatic conversion from the void * to the argument type, but
> > here such automatic conversion cannot happen because the
> > function pointer hasn't been declared with the correct type and
> > so the compiler doesn't know the actual type of the function
> > called.
> 
> Yes, if I specify any arguments of the function, this will produce 
> warnings for incompatible arguments, but I use pointer to a 
> function without any information of number or type of arguments, 
> so it is ok until I use proper function to an appropriate data 
> type.

You're calling the function pointer with incompatible arguments. Your
code now calls "func(f, i)" where 'f' is some "t_bs2bdp" type from the
library and "i" is a "void *" (BTW using 'i' for that is a really poor
choice of variable name as 'i' is almost always used as a general
integer variable). That means the compiler handles it as if the argument
types had been declared to be "t_bs2bdp, void *". You only don't get a
warning about this mismatch because you didn't specify the types
normally.

In short you simply should not use function declarations with empty
argument lists. The possibility to do that at all is marked as an
obsolescent feature in the C standard.




More information about the MPlayer-dev-eng mailing list