Unnecessary Macros (was Re: Unnecessary Parenthesis)

Doug Gwyn gwyn at smoke.ARPA
Wed Oct 5 14:14:49 AEST 1988


In article <701 at accelerator.eng.ohio-state.edu> rob at kaa.eng.ohio-state.edu (Rob Carriere) writes:
>In article <8590 at smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>>One wonders whether [the inability to define a square macro] is much of a
>>problem.
>How about the following, deep in some inner loop:
>foo = square( sin( x )) + 1.7;

Another silly example.  I can't imagine a real algorithm that would want
this computation in it.

>temp = sin( x );
>foo = temp*temp + 1.7;
>is clearly less legible.

Most programmers wouldn't have any trouble with
	foo = sin(x);
	foo = foo*foo + 1.7;

I agree that an exponentiation operator would be handy,
but a "square" macro doesn't seem to help readability.



More information about the Comp.lang.c mailing list