@Jack,
Thanks for the link!
Macros !!!!!
Fasm macros are cool, but I think they're not very useful if you want to deal with PB's code (variables and stuff). I would wait for PB's macros, those will be useful, I'm sure.
Last edited by El_Choni on Sun Apr 03, 2005 12:57 pm, edited 1 time in total.
El_Choni
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Hey. From Fasm preprocessor doc:Froggerprogger wrote:- you shouldn't use 'test' as a name for the macro, because TEST is a keyword in FASMCode: Select all
!macro bla !{ MessageRequester("test","hello") !} !bla !bla
You can also "overload" instruction with macro, because preprocessor doesnt' know about instructions, it allows macro name to be instruction mnemonics.
macro pusha
{
push eax ebx ecx edx ebp esi edi
}
macro popa
{
pop edi esi ebp edx ecx ebx eax
}

Well, sort of. AFAIK 'inline' is processed by the compiler while macros areDreglor wrote:isn't macros like c++ inline?
handled by the preprocessor. Inline supports typechecking for arguments,
macros are only literally copied into the caller's location.
In nowadays programming, inlined functions are considered better, there're
still some cases 'inline' won't help.
Good programmers don't comment their code. It was hard to write, should be hard to read.
I ran into a minor problem ...
If you declare a macro in an external include file,
You will get an error that the symbol is already defined.
I was hoping to place all my debugging code ...
compilerif #TestMode
if tracemode
calldebugger
endif
compilerendif
as a macro instead of a procedure in an include file.
Oh, I'm using PB3.91
It would help in making code more readable.
I really like this in procedures that return a value because I can ...
!CheckTestMode
Debug Reply
procedurereturn reply
endprocedure
That way, I can press the continue button and the debugger will
pause at the procedure end so I can read the return value.
Oh, it works fine in the main file, just not when the macro is defined
in the include.
UPDATE:
in the includefile, the macro was used inside a procedure ...
when removed from the procedure, everything worked ... Odd
If you declare a macro in an external include file,
You will get an error that the symbol is already defined.
I was hoping to place all my debugging code ...
compilerif #TestMode
if tracemode
calldebugger
endif
compilerendif
as a macro instead of a procedure in an include file.
Oh, I'm using PB3.91
It would help in making code more readable.
I really like this in procedures that return a value because I can ...
!CheckTestMode
Debug Reply
procedurereturn reply
endprocedure
That way, I can press the continue button and the debugger will
pause at the procedure end so I can read the return value.
Oh, it works fine in the main file, just not when the macro is defined
in the include.
UPDATE:
in the includefile, the macro was used inside a procedure ...
when removed from the procedure, everything worked ... Odd

Code is good... Its an international language.