Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!samsung!usc!snorkelwacker!bu.edu!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: Computing the absolute value of an integer Message-ID: <5790@buengc.BU.EDU> Date: 7 May 90 15:50:10 GMT References: <11679@june.cs.washington.edu> <1990May4.121950.22726@agate.berkeley.edu> <8977@hydra.gatech.EDU> <12710@wpi.wpi.edu> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 18 In article <12710@wpi.wpi.edu> oesterle@wpi.wpi.edu (Shawn H. Oesterle) writes: >In article <8977@hydra.gatech.EDU> dsrekml@prism.gatech.EDU (Mike Mitten) >writes: >>In article <1990May4.121950.22726@agate.berkeley.edu> >>c60c-3cf@e260-3c.berkeley.edu (Dan Kogai) writes: >>>What's wrong with using a macro like the following >>>#define abs(x) (((x) >= 0) ? (x) : -(x)) >>Won't both of these macros blow up if x is a function such as: >> y = abs(foo(bar)); > >That's right. That is one thing which I dislike about macros in C. Macros are a textual facility, not a functional one. --Blair "If you want the assembler, you know where to find it. (cf. D. Ritchie.; or was it B. Kernighan?)"