Return value from a macro

John S. Price john at stat.tamu.edu
Sat Feb 3 20:33:06 AEST 1990


In article <282 at isgtec.UUCP> robert at isgtec.UUCP (Robert Osborne) writes:
>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 

I agree.  Writing a macro that gets used in alot of different places
can cause the size of the executable to grow.  These types of macros
should be relative small (I believe putc() is a good example).
If you have a large macro, and it's used in one or two places,
as in the loop example above, by all means use it, because, as
it is mentioned above, the function call overhead does add up.

Just my $.02 worth.


--------------------------------------------------------------------------
John Price                   |   It infuriates me to be wrong
john at stat.tamu.edu           |   when I know I'm right....
--------------------------------------------------------------------------



More information about the Comp.lang.c mailing list