flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [fasmg] pe.inc : data types override |
Author |
|
Tomasz Grysztar 07 Apr 2017, 10:26
zhak wrote: But if I do dword 1, the flow seems to be macro dword > macro dd > macro dword >built-in dd?? because + is displayed twice. This "dword" macro was not supposed to be used directly, to avoid excess calls like in your example it would be better to make "dword" macro use "emit" instead of "dd". |
|||
07 Apr 2017, 10:26 |
|
zhak 07 Apr 2017, 12:02
So, it "digs down" in redefinitions.
Still the following doesn't make sence to me: Code: macro dword? value display '11 ' dd value end macro macro dword? value display '12 ' dd value end macro macro dword? value display '13 ' dd value end macro macro dd? value display '01 ' dword value end macro macro dd? value display '02 ' dword value end macro dword 1 The above does dword 13 > dd 02 > dword 12 > dd 01 > dword 11 > built-in dd, which is correct. Now, if remove dword 13, an error occurs because dword 12 > dd 02 > dword 11 > dd 01 > no more dword defined. The same applies if reduce further: remove macro dd 02 - works, then remove macro dword 12 - error. So, dword must be defined times dd defined + 1, in general. But this doesn't apply to the case when both dword and dd are defined once (as in original pe.inc example) -- it works instead of generating an error. Maybe it is silly things I ask, but why exactly does this happen? |
|||
07 Apr 2017, 12:02 |
|
Tomasz Grysztar 07 Apr 2017, 12:09
When "dword" is defined just once, it is not variable and therefore allows recursion. So when "dd" is called from "dword" and it in turn calls "dword", it calls the same "dword" macro, not a previous version like in the case when instruction is variable.
|
|||
07 Apr 2017, 12:09 |
|
zhak 07 Apr 2017, 12:12
It's clear now. Thanks a lot.
|
|||
07 Apr 2017, 12:12 |
|
revolution 07 Apr 2017, 12:14
I think that when you say "variable", it means the same as "overloaded" in HLL speak. i.e. same name but different code.
|
|||
07 Apr 2017, 12:14 |
|
Tomasz Grysztar 07 Apr 2017, 12:27
The "overload" happens when you define a symbol in the child namespace with the same name as one in the parent/global namespace. In fasmg these two mechanisms can be combined in different ways. You can have the overloading symbol in child namespace be variable while still having non-variable global one. For example if you have a variable "dd" macro defined in nested namespace and it calls the "dd" macro recursively, it is going to finally call "dd" in the parent namespace, and if that macro is not variable, it may proceed with a true recursion. You also may have a non-variable macro in local namespace and then it may call itself recursively, resulting in a complete overload of a global macro.
Generally in fasm term "variable symbol" means one that has no single universally accessible value, and therefore cannot be forward-referenced (nor self-referenced, as in case of recursion). The "overloading" happens when there are symbols with the same name but in different namespaces and one takes precedence over the other. |
|||
07 Apr 2017, 12:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.