Date: Wed, 30 Sep 92 14:18:37 CDT From: "George Jetson" To: mpsears AT newton DOT cs DOT sandia DOT gov Subject: Re: abs()olutely hopeless? Cc: djgpp AT sun DOT soe DOT clarkson DOT edu You wrote: >#define ABS(x) ((x) < 0 ? -(x) : (x)) >so that e.g. ABS(-a+b) works correctly. >Mark Sears Should that not actually be: #define ABS(x) \ ({typedef _tx = (x); \ _tx _x = (x); \ _x < 0 ? -_x : _x; }) (cribbed from the official #definition of max()) This yields the correct result when you do: foo = abs(bar += 17);