Unnecessary Macros (was Re: Unnecessary Parenthesis)

Karl Heuer karl at haddock.ima.isc.com
Tue Sep 27 05:09:34 AEST 1988


In article <8577 at smoke.ARPA> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <23 at datcon.UUCP> sar at datcon.co.uk (Simon A Reap) writes:
>>	z = square(x) + square(y);
>>Does anyone know how to get round this problem?  Please!!
>	z = x*x + y*y;

Doug's answer is certainly a better way to write the given example, but is not
particularly enlightening if you want
	z = square(*p++) + square(getchar());

I dislike the original macro, but the fact remains that there is no good way
to write this in C.  (There are several bad ways, and we could argue over
which is the least bad, but it really depends on the circumstances.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list