Le duodi 22 germinal, an CCXXIII, Luca Barbato a écrit : > - Set a value outside the working range > - Set a value to 0xfff..ff and then use in mask/shift operations.
That is very true, but you forgot to distinguish two variants in the first
case:
- Outside the working range because it is large:
unsigned min = UINT_MAX;
for (...)
if (v < min)
min = v;
In this case, UINT_MAX works, because it expresses the idea itself: larger
than anything else, it is really a matter of numeric order.
- Outside the working range because it is impossible:
unsigned best = -1;
for (...)
if (better)
best = i;
if (best == -1)
die("Sorry, not found\n");
In this case (assuming all the valid values are positive and reasonably
small, of course), -1 expresses the idea better, because -1 is an
impossible value for a positive integer.
(And, by the way, if you are sure that the "better" condition will succeed
at least once, then this is the perfect case for an assert().)
> To suppress it you can do the following:
Kick the bogus compiler somewhere it hurts.
But as Diego heavily emphasized, providing a "fair, productive
environment for developers and contributors" does not apply to me, so please
disregard my advice.
Regards,
--
Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
