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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to