flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > [BUG?] virtual directive and labels prefixed with a dot |
Author |
|
LocoDelAssembly 21 Jul 2006, 03:25
"p" is a label too and since it is located between "jmp .label_2" and ".label_2:" .label_2 is out of scope for that JMP. To get access to it before the definition of "p" use p.label_2 (jmp p.label_2).
Regards |
|||
21 Jul 2006, 03:25 |
|
UCM 21 Jul 2006, 17:15
Or, you could change the definition of "p dd ?" to "..p dd ?" which would not make it change the current scope, but would allow it to be accessed globally as ..p
|
|||
21 Jul 2006, 17:15 |
|
Reverend 22 Jul 2006, 12:57
But "p" is declared between "virtual" and "end virtual". Logically ".label_2" should not be attached to "p". In my opinion it is not maybe a bug, but unwanted bahaviour surely, and should be fixed.
|
|||
22 Jul 2006, 12:57 |
|
Tomasz Grysztar 22 Jul 2006, 13:32
The behavior is very straightforward (and such defined in manuals): "local" label get attached to the nearest preceding it "global" label in the source (in the actual preprocessed source text). This gives the simple interpretation for the cases like:
Code: a: if x=3 virtual end if b dd ? if x=4 end virtual end if .c: or Code: a: if x=3 b: end if .c: The last label is "b.c" no matter how and whether the "b" gets actually defined. This is at least easily determinable and is utilized by some of the macros. PS. The same goes for the anonymous labels (@@). |
|||
22 Jul 2006, 13:32 |
|
vid 24 Jul 2006, 06:55
Quote: PS. The same goes for the anonymous labels (@@). interesting, never realized it: Code: jmp @f ;ERROR - undefined symbol if 0 @@: end if @@: |
|||
24 Jul 2006, 06:55 |
|
chris 25 Jul 2006, 09:58
Quote: "p" is a label too and since it is located between "jmp .label_2" and ".label_2:" .label_2 is out of scope for that JMP. To get access to it before the definition of "p" use p.label_2 (jmp p.label_2). yes, that's what I thought where the problem is. Quote: Or, you could change the definition of "p dd ?" to "..p dd ?" which would not make it change the current scope, but would allow it to be accessed globally as ..p I just did it in my source to void this conflicts, and use .p also works in this case. Quote: But "p" is declared between "virtual" and "end virtual". Logically ".label_2" should not be attached to "p". In my opinion it is not maybe a bug, but unwanted bahaviour surely, and should be fixed. That's what I originally wanted to say, I used the virtual directive to define some lable to access the data field of a struct, and when compiling, I got the error, so, may be we should usually use double-dotted lables inside virtual directives. Quote: The behavior is very straightforward (and such defined in manuals): "local" label get attached to the nearest preceding it "global" label in the source (in the actual preprocessed source text). This gives the simple interpretation for the cases like: Quote:
thank you guys, got it. [/code] |
|||
25 Jul 2006, 09:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.