what exectly are macros?
Posted: Mon Jan 03, 2005 5:09 am
i been hear about macros being in 4.0,
and im wondering what exectly are they? what do they do?
and im wondering what exectly are they? what do they do?
http://www.purebasic.com
https://www.purebasic.fr/english/
It is even possible - FASM does that for example - to replace built-in commands with own macros. There was a tip likeDreglor wrote:i been hear about macros being in 4.0,
and im wondering what exectly are they? what do they do?
Code: Select all
macro inc v
{
pushf
add v,1
popf
}
macro dec v
{
pushf
sub v,1
popf
} Code: Select all
!macro inc v
!{
!pushf
!add v,1
!popf
!}
!macro dec v
!{
!pushf
!sub v,1
!popf
!}
foo = 4
Debug foo
!dec [v_foo]
Debug foo Macros are a nice and convienient way to obfuscate and confuse code to make it unreadable by all that has not coded it!Dreglor wrote:i been hear about macros being in 4.0,
and im wondering what exectly are they? what do they do?
Code: Select all
MACRO r.l = myDumbMacro a.l, b.l
local j.l
j = a * 10
r = j + b
EndMACRO
;-v-
Procedure myDumbProc(a.l, b.l)
j = a * 10
ProcedureReturn j + b
EndProcedure
result = myDumbMacro valueA, 2
; is effectively replaced with the machine code for
; local_j = valueA * 10
; result =local_ j + 2
-v-
result = MyDumbProc(valueA, 2)