Feature for the next C version
Zdenko Tomasic
zdenko at csd4.milw.wisc.edu
Sat Jul 29 14:29:52 AEST 1989
In article <1913 at prune.bbn.com> rsalz at bbn.com (Rich Salz) writes:
>In <1389 at crdgw1.crd.ge.com> davidsen at 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 at csd4.milw.wisc.edu
More information about the Comp.lang.c
mailing list