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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1d321b3a6b8bcab2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-29 00:06:07 PST Path: swrinde!ihnp4.ucsd.edu!network.ucsd.edu!mbk From: mbk@inls1.ucsd.edu (Matt Kennel) Newsgroups: comp.lang.ada Subject: Re: "Subtract C, add Ada" Date: 29 Jan 1995 08:06:02 GMT Organization: Institute For Nonlinear Science, UCSD Message-ID: <3gfi9a$g4d@network.ucsd.edu> References: <3gdro9$aud@spam.csv.warwick.ac.uk> NNTP-Posting-Host: gibbs.ucsd.edu X-Newsreader: TIN [version 1.1 PL8] Date: 1995-01-29T08:06:02+00:00 List-Id: Jules (csusb@csv.warwick.ac.uk) wrote: : In article <3g1shu$ksc@rational.rational.com>, : davidm@rational.com (David Moore) writes: : >It is also easy to write abominations like: : > : > -- search the table : > : > while (a[i++]!=b); : > : >Whenever you use post-increment in a condition, you always have to stop and : >wonder about your post-condition - I find it easier to always write the : >loop out in full. : It is also easy to write stupid code like this when NOT using shorthand code : like this. : Of course the correct version (and the version I still prefer) is: : while (a[i++]!=b && i < ARRAYLIMIT); Better yet is to have a smart loop abstraction. For example: loop e := a.elt!; -- automagically step through elements of a. if (e = b) then break! end; -- otherwise do stuff here. end; Now isn't that what you really meant to say before? -- -Matt Kennel mbk@inls1.ucsd.edu -Institute for Nonlinear Science, University of California, San Diego -*** AD: Archive for nonlinear dynamics papers & programs: FTP to -*** lyapunov.ucsd.edu, username "anonymous".