Careful "for" Loops

Doug Gwyn gwyn at smoke.brl.mil
Thu Mar 21 07:25:03 AEST 1991


In article <MCDANIEL.91Mar19124111 at dolphin.adi.com> mcdaniel at adi.com (Tim McDaniel) writes:
>1) How do you code a "for" loop to avoid overflow gotchas?

(a) Use pointers instead.
(b) Don't push against the very limit of the representable range.
(c) Use unsigned types and compare for equality with zero.
(d) Consider each case on its own merits.



More information about the Comp.lang.c mailing list