Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!thetone!swilson From: swilson%thetone@Sun.COM (Scott Wilson) Newsgroups: comp.lang.c Subject: Re: Unnecessary Macros (was Re: Unn Message-ID: <70616@sun.uucp> Date: 28 Sep 88 17:00:47 GMT References: <70279@sun.uucp> <225800075@uxe.cso.uiuc.edu> Sender: news@sun.uucp Reply-To: swilson@sun.UUCP (Scott Wilson) Organization: Sun Microsystems, Mountain View Lines: 22 >>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@sun.com Sun Microsystems uucp: ...!sun!swilson Mt. View, CA