What are the differences between Macro's and Proc's? How do I know which type to use? What are the advantages for both? Thanks for helping a complete newbie!
Posted on 2001-01-03 00:26:00 by Frank Hale
A Proc (procedure) is a sub routine. Include the code once, call it many times. A macro is, well, can be lots of things. It doesn't necessairly have to make code. It can make other definitions, but let's say we just mean macros that make code. Every time you write the macro into your program, another copy of the code is included. That's faster then calling a proc, but bigger in terms of space. Engineering is always about choosing the proper compromise.
Posted on 2001-01-03 01:14:00 by Ernie
Frank, A PROC is a reusable piece of code that is called with the parameters on the stack, it can be either in the form of a SUB or FUNCTION and if a piece of code is called many times, this is the most economical way to write the code in size terms. A MACRO is basically a TEXT expansion of a single term into whatever you write in the macro. For example, if you write a MACRO, MyMacro MACRO Par1, par2 ; write code using the parameters ENDM When you write the name of the MACRO in your code, when it is assembled, it EXPANDS the macro name into the code you write in the macro complete with the parameters that you used. The upside of MACROs is that they are written directly inline in the code and don't have the stack overhead of a PROC but the downside is that they repeat the code as many times as you call it so it is up to the programmer to decide if the speed or convenience factor justifies the extra code. They of course can do many other things but this is the basics of macros. Regards, hutch@pbq.com.au
Posted on 2001-01-03 07:19:00 by hutch--