Article View: comp.sys.mac
Article #23142Re: Lightspeed C bug?
From: Rich Siegel
Date: Thu, 24 Dec 1987 14:13
Date: Thu, 24 Dec 1987 14:13
27 lines
1256 bytes
1256 bytes
In article <870081@hpcilzb.HP.COM> cnc@hpcilzb.HP.COM (Chris Christensen) writes:
>#define ABS(x) (((x) < 0) ? -(x) : (x))
This is a macro definition. When you use it, "Random()" is going
to get substituted for "x" everywhere in this macro. Therefore, "Random()"
will get called twice for any given invocation of this macro.
>x = ABS(Random()) % 8;
Is not correct.
A correct usage would be:
x = Random();
x = ABS(x) % 8;
>Am I being bitten by a "one pass" compiler bug?
Nope.
--Rich
**The opinions stated herein are my own opinions and do not necessarily
represent the policies or opinions of my employer (THINK Technologies).
* Richard M. Siegel | {decvax, ucbvax, sun}!harvard!endor!singer *
* Customer Support | singer@endor.harvard.edu *
* Symantec, THINK Technologies Division. (No snappy quote) *
Technical Details
Message-ID:
<3650@husc6.harvard.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!endor!singerReferences:
<870081@hpcilzb.HP.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!endor!singer From: singer@endor.harvard.edu (Rich Siegel) Newsgroups: comp.sys.mac Subject: Re: Lightspeed C bug? Message-ID: <3650@husc6.harvard.edu> Date: 24 Dec 87 14:13:57 GMT References: <870081@hpcilzb.HP.COM> Sender: news@husc6.harvard.edu Reply-To: singer@endor.UUCP (Rich Siegel) Organization: THINK Technologies, Bedford, MA Lines: 27