Re: wrapping macros?
- Posted by Bernie <xotron at PCOM.NET> Oct 28, 2000
- 444 views
On Fri, 27 Oct 2000 21:14:10 -0600, cense <cense at MAIL.RU> wrote: >The macros i want to use are not as simple as MIN(a, b) they are actually >complex for just a macro, i wonder why they did not use routines instead. >Ah well, ancient socket code is odd, quite odd. cense: The are two basic purposes for using MACROS in programming. 1. A macro is defined at the beginning of a program and given a MACRO name. Then when ever a programmer invokes that MACRO's name later in the program. The code is then inserted directly at that point in the programmer's program when EVER the MACRO name is used. This is different than calling a function because the a function's code is only inserted in the program in ONE place and called from other places in the program. Placing the same code in more than 1 place in a programming in some languages increases speed by eliminating the overhead of calling but this also icreases the size of the program. 2. The second kind of MACRO is used as a kind of TEMPLATE. The progammer invokes the MACRO's name using it different parameters when the compiler see the MACRO name it inserts the code at the location where the MACRO name is invoked but uses DIFFERENT code depending on what parameters were used when the MACRO name was invoked. You should now be able to answer the question; can I use a function call instead of a MACRO. The only thing that is complicated is determining what exactly the MACRO is used to accomplish. I hopes this clears this up for you. Bernie