
Assemblers and Macro Processors 445
Macros and Subroutines
Seemingly, from the viewpoint of the programmer, macros provide the same kind of facilities as
subroutines. Then how do they compare?
Macro: Complete macro body code gets substituted every time it is used, so increases the code
length. As it is in-line code, save on the subroutine call and return instruction time and stack load
overheads, and thus works fast.
Subroutine: Code is included only once in the program. Time and stack-space overheads for each
call and return.
In summary, we can say that if the job can be done with a few instructions, say 5 to 10, then it may be
advisable to implement ...