Author: Dieter Buerssner
Date: 11:31:30 07/06/03
Go up one level in this thread
On July 06, 2003 at 14:05:03, Omid David Tabibi wrote: >On July 06, 2003 at 13:12:25, Robert Hyatt wrote: >>#define abs(x) ((x<0) ? -x : x) >What's the difference between the above macro and the function > >int simple_abs (int i) { > return (i >= 0) ? i : -i; >} > >when inlined? The macro will fail, when called as abs(++x) or abs(rand()-N) and in more cases. Will be slow in other cases. When it is called as intended (simple argument with no side effect), it is the same. Regards, Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.