[FFmpeg-devel] [PATCH] libavcodec/wmavoice.c: local variablepow might mask pow function

Axel Holzinger aholzinger
Mon Jul 26 10:27:34 CEST 2010


Hi Eli et al,

On Sun, Jul 25, 2010 at 9:41 PM, Eli Friedman wrote:
> On Sun, Jul 25, 2010 at 12:18 PM, Axel Holzinger 
> <aholzinger at gmx.de> wrote:
> > The issue is that a local variable pow masks a function pow 
> > and that hurts if powf - which is used in the scope of local 
> > variable pow - is not a function but a macro using double
> > precision pow function.
> 
> And I'm pointing out that such an implementation is not 
> correct per C99.

I read the standard and under 7.1.4 (1) it's stated that standard
headers may export function like macros. I don't see how this couldn't
be correct C99. Could you please provide a reference where it's stated
that a function like macro is forbidden in a standard header (at least
for powf)?

Also Unix/Posix allows powf to be implemented as a macro:
http://www.opengroup.org/onlinepubs/009695399/basedefs/math.h.html

> > Besides taking the effort to apply and document a patch, 
> > what do you think stands against the patch?
> 
> Simply that you haven't actually pointed to why this is 
> necessary other than the abstract possibility of a 
> non-conforming implementation of math.h.

As mentioned above, I can't see why such an implementation would be
non-conforming. Can you elaborate.

I think I did point out why this is important and together with the
above it's a potential problem that I tried to help to fix.

What is to say against a patch that

- doesn't add a single additional character
- doesn't change the structure of the code
- doesn't uglify the code
- does keep the variable naming in terms of being self explaining
- makes the code more widely usable

But there is another possibility: You could put the powf call in
parenthesis "using(powf)(...)" instead of "powf(...)". This would
prevent macro usage for powf.

But doesn't this uglify the code?

Regards
Axel




More information about the ffmpeg-devel mailing list