From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: ** X-Spam-Status: No, score=2.6 required=5.0 tests=BAYES_40,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.lang.c:29520 comp.lang.ada:3947 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!microsoft!t-wader From: t-wader@microsoft.UUCP (Wade Richards) Newsgroups: comp.lang.c,comp.lang.ada Subject: Re: bug me now / bug me later Message-ID: <55151@microsoft.UUCP> Date: 11 Jun 90 22:19:17 GMT References: <811@sagpd1.UUCP> Reply-To: t-wader@microsoft.UUCP (Wade Richards) Organization: Microsoft Corp., Redmond WA Summary: Expires: Sender: Prefered-Food: Pizza Shoe-Size: 10 1/2 Followup-To: Disclaimer: I don't always agree with my boss, why should he agree with me? List-Id: In article <811@sagpd1.UUCP> jharkins@sagpd1.UUCP (Jim Harkins) writes: =} =}Lets say you have the following (you ADA people, please bear with me): =} =} #define SIZE 6 =} #define STEP 2 =} =}Which is better: =} =} a. for(i = SIZE; i != 0; i -= STEP) =}or =} b. for(i = SIZE; i > 0; i -= STEP) =} It depends on the situation. If you know that i will exactly equal zero (as in this case), then I think that's what you should test for. However, I would probally put: assert( SIZE % STEP == 0 ) before the loop, to make sure nothing blows up, and (more importantly) to make it quite clear what was at fault if it does blow up. --- Wade