Unnecessary Macros (was Re: Unn
Scott Wilson
swilson%thetone at Sun.COM
Thu Sep 29 03:00:47 AEST 1988
>>Maybe I'm missing the point, but why does a good old fashion function seem
>>to be out of the question.
>
>I certainly hope you aren't a programmer. The answer is blatently
>obvious: calling overhead.
Actually I am a programmer, but please don't tell Sun what an idiot
I am or they'll want their money back :-). If you look at what I wrote,
I said "out of the question" not "less efficient". I am very aware
of calling overhead and why it can be bad. What I was responding to
was the attitude that there just isn't any good way to square a number
in C. The solution I suggested was to use a macro when there were no
possible ill side effects and use a function when there were (just like
getc and fgetc). So what is wrong with that? Through the years I've
learned one important thing: correctness first, efficiency later. There's
nothing terribly exciting about a program that works incorrectly and
does it very quickly at the same time.
--
Scott Wilson arpa: swilson at sun.com
Sun Microsystems uucp: ...!sun!swilson
Mt. View, CA
More information about the Comp.lang.c
mailing list