[FFmpeg-devel] [PATCH 001/244] Add a new channel layout API

Nicolas George george at nsup.org
Mon Dec 9 21:34:45 EET 2019

Michael Niedermayer (12019-12-09):
> mixing unsigned and signed int of course works if one is aware of
> * what is signed, what is unsigned
> * exact semantics of expressions mixing them
> * does not miss any corner cases

I think it is reasonable to demand from FFmpeg developers that they know
enough C to be at ease with this.

And for remembering exactly and not missing corner cases, there are
compiler warnings. IIRC they are not enabled in FFmpeg, but they do lead
to a much better code hygiene.

> OTOH if everything is signed, then the developer does not need to worry
> about these things, and its easier to remember "all is signed int" vs.
> "these specific fields are unsigned"

Indeed. Instead, if everything is signed, they have to worry about the
many undefined behaviors attached with signed. Plus the risks that are
not related to UB, like checking that an array index is small enough but
forgetting to check non-negative.

Considering the time you spent recently "fixing" signed integer
overflows, I suspect you may be receptive to the fact that unsigned
arithmetic is entirely specified.


  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/477b5789/attachment.sig>

More information about the ffmpeg-devel mailing list