While this unsigned wrap method is technically valid, it certainly isn't
obvious, and making code readable should be a goal as well as making it correct.
After all, code which is hard to read is hard to understand, making it hard to
maintain. I therefore suggest the simpler form:
for (i = count; i--; ) {
which gives the same i values inside the loop, but does assume that the reader
remembers that i is unsigned, and intuitively understand wraparound while
passing zero.
--
Bill Davidsen <davidsen@tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
--