Path: utzoo!utgpu!watmath!iuvax!mailrus!csd4.milw.wisc.edu!zdenko From: zdenko@csd4.milw.wisc.edu (Zdenko Tomasic) Newsgroups: comp.lang.c Subject: Re: Feature for the next C version Message-ID: <3601@csd4.milw.wisc.edu> Date: 29 Jul 89 04:29:52 GMT References: <1389@crdgw1.crd.ge.com> <1913@prune.bbn.com> Sender: news@csd4.milw.wisc.edu Reply-To: zdenko@csd4.milw.wisc.edu (Zdenko Tomasic) Organization: University of Wisconsin-Milwaukee Lines: 25 In article <1913@prune.bbn.com> rsalz@bbn.com (Rich Salz) writes: >In <1389@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes: >... >Ick. The impression I have is that most folks think arithmetic IF is >a bad thing. I don't really know, and it doesn't matter too much. > The arithmetic if is useful only with integer expression and when all three branches are different. The problem is that it forces on programmer at least 2 or 3 labels (usually with 0-3 go to's) when 1 or 2 will do in the corresponding logical if statement or 0 or 1 with if-then-else statement. "Smart" programers also often like to get "tricky" by positioning the arithmetic if branches all over the code or making "knots" in the program flow. However, most of the above is cured by DISCIPLINED PROGRAMMING and not the abolishment of the arithmetic if statement. Moral: Use it only for distinct three-way branches and other ifs for other cases (know your tools!). -- ___________________________________________________________________ Zdenko Tomasic, UWM, Chem. Dept., P.O. Box 413, Milwaukee, WI 53201 UUCP: uwvax!uwmcsd1!uwmcsd4!zdenko ARPA: zdenko@csd4.milw.wisc.edu