Path: 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 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) *