Unnecessary Macros (was Re: Unnecessary Parenthesis)

Warren Tucker edp at pyr.gatech.EDU
Wed Oct 5 08:08:48 AEST 1988


In article <701 at accelerator.eng.ohio-state.edu> rob at kaa.eng.ohio-state.edu (Rob Carriere) writes:
>How about the following, deep in some inner loop:
>foo = square( sin( x )) + 1.7;
>I *don't* want to write:
>foo = sin( x )*sin( x ) + 1.7;
>and
>temp = sin( x );
>foo = temp*temp + 1.7;
>is clearly less legible.
>
>Rob Carriere
It may be less legible to use 'temp' but sin(x)*sin(x) calculates the
sine of x twice.

-- 
Warren Tucker
...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!edp



More information about the Comp.lang.c mailing list