flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Local labels interfere with naming space |
Author |
|
macomics 22 Nov 2023, 17:08
Code: macro m { local a a: } b: jmp .c m b.c: Code: macro global name* { if 0 label name end if } macro m { local a a: } b: jmp .c m global b .c: |
|||
22 Nov 2023, 17:08 |
|
Tomasz Grysztar 22 Nov 2023, 18:28
Section 2.3.3 of the manual wrote: If the name given as parameter to LOCAL directive begins with a dot or two dots, the unique labels generated by each evaluation of macroinstruction will have the same properties. If you would prefer an assembler with single, unified language, there is fasmg, fasm's successor. It has proper separation of namespaces and symbols local to macros do not interfere with the other ones. |
|||
22 Nov 2023, 18:28 |
|
revolution 22 Nov 2023, 21:55
Use the double dot.
Code: macro m { local ..a ..a: } |
|||
22 Nov 2023, 21:55 |
|
pfranz 24 Nov 2023, 02:37
That's what I do, I use one or two dots, but I just found notable that local labels would interfere outside their macros.
Two dots perfectly solve the problem. |
|||
24 Nov 2023, 02:37 |
|
revolution 24 Nov 2023, 02:46
local just creates a unique name, it doesn't make any sort of special label.
Code: ~ cat test.asm macro m { local a display `a,10 } rept 16 {m} ~ fasm test.asm flat assembler version 1.73.31 (16384 kilobytes memory) a?0 a?1 a?2 a?3 a?4 a?5 a?6 a?7 a?8 a?9 a?A a?B a?C a?D a?E a?F 1 passes, 0 bytes. ~ |
|||
24 Nov 2023, 02:46 |
|
pfranz 24 Nov 2023, 02:53
In my opinion there shouldn't be any special label, it should just be separated from the "outside world" (hence the word "local"). Like this is "semi-local".
Anyway there is no practical problem, another solution is to use: a = $ instead of a: |
|||
24 Nov 2023, 02:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.