[FFmpeg-devel] Moving if(constant expression) to preprocessor?

Reimar Döffinger Reimar.Doeffinger
Sat Sep 18 18:07:30 CEST 2010

On Sat, Sep 18, 2010 at 06:00:40PM +0200, Axel Holzinger wrote:
> You could leave this up to me or others.
> It is possible to write a macro that does the trick and in the end the
> above line would for example look like this:
> AV_COND_IF(CONFIG_##X##_HWACCEL, (av_register_hwaccel(&x##_hwaccel)),)
> ; }
> Wouldn't that still be fine? And it could be done with a few lines of
> generic macro defintions that could go to some generic header.
> What would be the disadvantage?

1) It's a rather obfuscated mess
2) There's a lot more where this won't work
3) The compiler will not syntax-check (actually it can even
   run quite a lot of static analysis) the disabled code

And I don't think there's any way you'll be able to solve 3)

More information about the ffmpeg-devel mailing list