🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #23161

Re: Lightspeed C bug?

#23161
From: Gerald Edgar
Date: Fri, 25 Dec 1987 14:40
15 lines
979 bytes
In article <870081@hpcilzb.HP.COM> cnc@hpcilzb.HP.COM (Chris Christensen) writes:
.....
>#define ABS(x) (((x) < 0) ? -(x) : (x))
>x = ABS(Random()) % 8;

The preprocessor converts this to:

 x = (((Random()) < 0) ? -(Random()) : (Random())) % 8;

So that Random() will be evaluated twice.
-- 
  Gerald A. Edgar                               TS1871@OHSTVMA.bitnet
  Department of Mathematics                     gae@osupyr.UUCP
  The Ohio State University  ...{akgua,gatech,ihnp4,ulysses}!cbosgd!osupyr!gae
  Columbus, OH 43210                            70715,1324  CompuServe
Technical Details
Message-ID: <364@osupyr.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!cbosgd!osu-cis!osupyr!gae
References: <870081@hpcilzb.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!cbosgd!osu-cis!osupyr!gae
From: gae@osupyr.UUCP (Gerald Edgar)
Newsgroups: comp.sys.mac
Subject: Re: Lightspeed C bug?
Message-ID: <364@osupyr.UUCP>
Date: 25 Dec 87 14:40:47 GMT
References: <870081@hpcilzb.HP.COM>
Reply-To: gae@osupyr.UUCP (Gerald Edgar)
Organization: The Ohio State University, Dept. of Math.
Lines: 15