[FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression

Tobias Rapp t.rapp at noa-archive.com
Fri May 5 15:44:07 EEST 2017


On 05.05.2017 09:26, Carl Eugen Hoyos wrote:
> 2017-05-05 3:12 GMT+02:00 Aaron Levinson <alevinsn at aracnet.com>:
>> On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote:
>>> Hi!
>>>
>>> It may be better to disable the warning.
>>>
>>> Carl Eugen
>>>
>>> -        num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN);
>>> +        num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN);
>>
>> In order to preserve the original logic, why not do the following:
>>
>> +        num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY : NAN);
>
> Simpler patch attached.

The GCC warning is not that bad, IMHO both proposed code alternatives 
are more readable than the original line.

Just my 2c.

Tobias




More information about the ffmpeg-devel mailing list