Unnecessary Macros (was Re: Unn
Dave Jones
djones at megatest.UUCP
Thu Sep 29 07:54:59 AEST 1988
>>In article <23 at datcon.UUCP> sar at datcon.co.uk (Simon A Reap) writes:
>> z = square(x) + square(y);
>
>Maybe I'm missing the point, but why does a good old fashion function seem
>to be out of the question.
>
It is not out of the question by any means. It is just that on
some implementations, especially those with hardware integer multiply,
and for some applications, the function call overhead may add
significantly to the execution time.
As has already been pointed out, the "morally correct" way to do it is,
z = x*x + y*y;
avoiding both the SLM* and the function call.
*SLM /ess el em/ n. (comp. acrnm.) Silly little macro.
P.s.
I attempted to post the following directly to Mr. Reap, but I could
not find a path.
Dear Mr. Reap,
I hope you are not too put off by any response to your question
which you may have seen. Most of the programmers here in the
U.S. are quite polite and helpful. A few are not, and the net
attracts them. I suspect that most of these fellows have yet to
hold down a full time programming job producing real products
which must compete in the marketplace.
That almost invariably cures such arrogance. After two or three
years, they generally discover, that (1) they are not as good as
they thought they were, (2) they are not as good as most of
the people who have been doing it longer, and (3) in this
business, it is very easy to look like a jerk.
Please, don't ask me how I know.
Best wishes,
Dave
More information about the Comp.lang.c
mailing list