[FFmpeg-devel] [PATCH 001/244] Add a new channel layout API
Nicolas George
george at nsup.org
Mon Dec 9 01:36:11 EET 2019
Michael Niedermayer (12019-12-09):
> One problem with unsigned is that in expressions you cannot have negative
> values, nor can you compare to negative values without casting to signed.
> That has some risk for producing unexpected behavior bugs
>
> for example
> if (ch >= s->nb_channels) {
> ...
> } else if (ch < 0)
> ...
>
> would not work as expected
I do not see it as a problem, I see it as exactly what we want. If a
value cannot meaningfully be negative, there is no sense in wasting time
and code allowing it to be negative and then testing it.
In the above code, ch should be unsigned too. Or, if it has a good
reason to be signed (negative values meaning something else?), test them
first.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191209/dbf66b13/attachment.sig>
More information about the ffmpeg-devel
mailing list