[FFmpeg-devel] [PATCH 1/4] avutil/tablegen: add tablegen libm compatibility shims

Ganesh Ajjanagadde gajjanag at mit.edu
Sat Nov 28 20:33:21 CET 2015


On Sat, Nov 28, 2015 at 1:31 PM, Derek Buitenhuis
<derek.buitenhuis at gmail.com> wrote:
> On 11/28/2015 5:03 PM, Ganesh Ajjanagadde wrote:
>> +static inline double ff_cbrt(double x)
>> +{
>> +    return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0);
>> +}
>> +#define cbrt ff_cbrt
>
> Didn't Clément say to not pollute the global namespace like this?

There are 2 answers to this. For reference, here is the quote by Clement:

"it's pretty fine with me to use a simple hack like this, but then i'd
argue it's better if the global c namespace is not polluted with openly
broken implementations: just name the macro differently (ffrint,
simplerint, or whatever) to make sure someone doesn't end up using it in a
different context where negative values matter (and where the issue won't
get detected quickly)"

1. These implementations are not openly broken, since I actually
copied stuff from avutil/libm here, based on this review. Thus, that
aspect does not apply.
2. Clement's idea AFAIK does not work, since the names must be
identical to the standard C names for the build to work with/without
hardcoded tables. BTW, this was also pointed out by me in a reply to
that quote.

>
> - Derek
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list