flat assembler
Message board for the users of flat assembler.

Index > Main > Defining fully qualified labels: bug or feature?

Author
Thread Post new topic Reply to topic
PopeInnocent



Joined: 01 Jan 2004
Posts: 18
Location: USA
PopeInnocent 29 Jan 2004, 04:21
fasm 1.50 assembles the following code:

Code:

struc foo {
 .x dd ?
     .y dd ?
}

virtual at 0
       foo foo
     foo.SIZE = $
end virtual

baz:

dd foo.x
dd foo.y
dd foo.SIZE

foo.bar = 0x1234

dd foo.bar
    


which generates the expected output (in dwords):

0
4
8
0x1234

My concern is with the line "foo.bar = 0x1234". That form of label definition doesn't appear to be documented in fasm.txt.

So, is this a feature that I can count on using (and I can find many, many uses for it), or a bug/implementation detail that will disappear in a future release?
[/code]
Post 29 Jan 2004, 04:21
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 29 Jan 2004, 04:54
I think Privalov was about to remove it?

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 29 Jan 2004, 04:54
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 29 Jan 2004, 08:18
No, I was not. Dot is a normal character that can occur inside any label name, and thanks to it 'struc' mechanism can work the way it works (as it is a special type of macroinstruction). Also "foo.SIZE" in your example is defined the same way. There is no difference between "foo.SIZE" and "foo.bar" definition in your code, they are both fully correct and allowed.

In the docs I write about the labels beginning with a dot or two dots (as these labels have some special meaning), so I thought it should be clear from it that dots in label names are allowed.
Post 29 Jan 2004, 08:18
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 29 Jan 2004, 08:43
As far, as I can understand, the point here is that such definitions actually define local label in the label space of some global label, even when the definition is outside the scope of this global label. For example:
Code:
MyLabel.local = 1234h

MyLabel0:
        mov     eax, .local             ; error "undefined symbol"
        mov     eax, MyLabel.local      ; Normal mov eax, 1234h

MyLabel:
        mov     eax, .local     ; Normal mov eax, 1234h
.local = 5678h
        mov     eax, .local     ; Normal mov eax, 5678h

MyLabel2:
        mov     ebx, .local     ; Error "undefined symbol"
        mov     ebx, MyLabel.local ; Normal mov ebx, 5678h
    


I think this is natural and normal behaviour and it is definately a "feature" even if it appears as a "side effect". Smile

Regards
Post 29 Jan 2004, 08:43
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.