Path: utzoo!censor!isgtec!robert From: robert@isgtec.UUCP (Robert Osborne) Newsgroups: comp.lang.c Subject: Re: Return value from a macro Message-ID: <282@isgtec.UUCP> Date: 2 Feb 90 20:04:19 GMT References: <1990Jan28.040427.22679@virtech.uucp> Reply-To: robert@isgtec.UUCP (Robert Osborne) Distribution: usa Organization: ISG Technologies Inc., Mississauga, Ontario Lines: 15 In article <1990Jan28.040427.22679@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes: >A second problem is that the macros provide a slight performance gain by not >having the function call overhead, but they increase the program size by >duplicating code (the exact problem that functions/subroutines were designed >to solve). This is especially worse with complicated macros. > >Don't get me wrong. I have nothing against macros and use them quite often. >However, one should not blindly implement functions as macros. The important thing is to know when to use macros. Sometimes inline macros can cut the execution time from 12 minutes to 2-3 (to use a actual example from here). Often the performance gain is NOT slight. Using a macro inside a critical loop that gets performed 500,000 times is not only "good" it's a necessity. Writing a macro to replace fprintf is stupid. -- Robert A. Osborne {...uunet!mnetor,...utzoo}!lsuc!isgtec!robert