Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!gatech!prism!cc100aa From: cc100aa@prism.gatech.EDU (Ray Spalding) Newsgroups: comp.lang.c Subject: Re: Feature for the next C version Message-ID: <1290@hydra.gatech.EDU> Date: 30 Jul 89 01:00:35 GMT References: <1389@crdgw1.crd.ge.com> <1913@prune.bbn.com> Reply-To: cc100aa@prism.gatech.EDU (Ray Spalding) Organization: Georgia Institute of Technology Lines: 29 In article <1913@prune.bbn.com> rsalz@bbn.com (Rich Salz) writes: >... >Easy enough. First, create a helper function: > int > sgn(x) > int x; > { > return x ? (x < 0 : -1 : 1) : 0; ^ > } >... That colon should be a question mark, I believe. My understanding of the arithmetic (3-way branch) IF in Fortran is that in ancient (pre '66) compilers it was often the ONLY type of conditional branch implemented. In an attempt to be "portable", many programmers used this type of IF exclusively. IMHO, arithmetic IFs make programs needlessly difficult to understand. This is due to the expression having to work out relative to zero, and (as was pointed out before) the number of statement labels and goto's required. I hope I never see another one. And, I certainly hope no such anachronism is ever adopted in C. -- Ray Spalding Georgia Institute of Technology, Atlanta Georgia, 30332 uucp: ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!cc100aa Internet: cc100aa@prism.gatech.edu