I have some questions about Macros. I think I know the
answers, but like The Svin said there are no tuts.
1: Macros always generate inline code, correct?
.IF Question1 == TRUE
2: Should I try to use macros over
procs, when possible?
.ENDIF
3: Are there any problems with putting macros in LIBs?
Thanks Ernie!
1: Well... yeah I guess. IF they make code at all. They don't have to.
But I get what you mean. Yes, macros do make a nice way to inline code.
2: It's a trade off, speed vs size. Inline code is faster, proc code is smaller. Inline also cannot have a stack frame for locals.
3: Nope, macros can't go into libs. Libs are pre-compiled code.
(So put then in .inc files) ;-)
xtreme,
1. Yes, if they are designed to write code, they will place a copy of the code at each place you call the macro.
2. NO, they are different things, macros can be used to pack unchanging code in convenient ways, inlining repeat code without all the typing etc .. Library modules are more efficient in size and convenience terms and can do more complex things so basically you select which does the job for you in the code you are writing, both have their place.
3. A library module can use a macro but macros cannot be compiled into a library of their own, a macro is basically a text expansion and are stored like source code. This is reliable and unproblematic.
Regards,
hutch@pbq.com.au