Quoting Diego Biurrun (2015-04-11 15:04:43) > On Sat, Apr 11, 2015 at 02:18:38PM +0200, Nicolas George wrote: > > Le duodi 22 germinal, an CCXXIII, Diego Biurrun a écrit : > > > > > - unsigned int code = -1; > > > > > + unsigned int code = 0xffffffff; > > > > Why change this? AFAIK it's perfectly valid C. > > > Citation required. > > > > # A computation involving unsigned operands can never overflow, because a > > # result that cannot be represented by the resulting unsigned integer type > > is > > # reduced modulo the number that is one greater than the largest value that > > # can be represented by the resulting type. > > > > (6.2.5 Types, #9) > > This explains how unsigned arithmetic wraparound works, not what happens > when you assign negative values to unsigned variables.
6.3.1.3.2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type. I don't think there's any disagreement over whether this behaviour is valid or not -- it's perfectly valid C and is guaranteed to do exactly the same thing as assigning the corresponding *_MAX. It's just a question of readability. > > > Speaking only for me, I would find very rude if I were to express and force > > on others ideas on readability and validity about a language that I do not > > actually know. > > Rude is your continued trolling on this mailing list. Please take it back > to your FFmpeg home turf where such behavior is apparently tolerated. It > is not tolerated here. You're also not being very nice here. IMO you should both take it easy. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
