Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!hsi!palmer From: palmer@hsi.UUCP (Mike Palmer) Newsgroups: comp.lang.c Subject: Re: Possible C Anomaly Message-ID: <682@hsi.UUCP> Date: Thu, 17-Sep-87 11:51:02 EDT Article-I.D.: hsi.682 Posted: Thu Sep 17 11:51:02 1987 Date-Received: Sat, 19-Sep-87 18:11:11 EDT References: <9270@brl-adm.ARPA> <5112@jade.BERKELEY.EDU> Organization: Health Systems Intl., New Haven, CT Lines: 37 In article <5112@jade.BERKELEY.EDU>, mwm@eris.BERKELEY.EDU (Mike (My watch has windows) Meyer) writes: > In article <9270@brl-adm.ARPA> mrd@sun.mcs.clarkson.EDU (Michael R. DeCorte) writes: > < /* Example #1 */ k = (k > 1) ? k-- : 1; > < > < My intent was to decrement k with each pass until it reached 1 and then to > < keep it at one. There are a variety of ways to accomplish this but I just > < happened to try this one first. > > < k = (k > 1) ? --k : 1; > > No! Consider that you're doing (one way) "k = --k". You still don't know ... stuff deleted ... > < k = (k > 1) ? (k - 1) : 1; > > Much better - it's right. why not just use (k > 1) ? k-- : (k = 1); or better yet (k > 1) ? k-- :; just my two cents. -- Mike Palmer {uunet,ihnp4,yale}!hsi!palmer Health Systems International New Haven, CT 06511 USA