[FFmpeg-cvslog] r14469 - trunk/libavcodec/ra288.c

Uoti Urpala uoti.urpala
Tue Jul 29 21:14:59 CEST 2008


On Tue, 2008-07-29 at 19:41 +0100, M?ns Rullg?rd wrote:
> IMO, it is better to declare things as unsigned, when a negative value
> is meaningless.  It makes range checking simpler, if nothing else.

I don't quite agree about using that as a general rule. Declaring
something unsigned has more than one effect. First it means that it can
never hold a negative value; that part is usually beneficial. However if
you make an int-sized or larger variable unsigned it also means that the
results of normal arithmetic operations involving the variable will
become unsigned, and that can cause nasty traps. Even if a negative
value for the variable itself would be meaningless that doesn't mean all
calculations which use the variable and give a negative result would be
meaningless.





More information about the ffmpeg-cvslog mailing list