Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Careful "for" Loops Message-ID: <15524@smoke.brl.mil> Date: 20 Mar 91 21:25:03 GMT References: Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 7 In article mcdaniel@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.