flat assembler
Message board for the users of flat assembler.

Index > Main > [solved] jmp/struct (doesn't compile, why ?)

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 02 Oct 2010, 20:44
Code:
does compile
------------

include 'win32a.inc'

jmp  toto

struct Z
   v dd ?
ends

toto:
    

Code:
does not compile <<<<----------  why ??
----------------

include 'win32a.inc'

jmp  .toto

struct Z
   v dd ?
ends

.toto:
    
thank you all Razz

_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 03 Oct 2010, 10:05; edited 2 times in total
Post 02 Oct 2010, 20:44
View user's profile Send private message Send e-mail Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 02 Oct 2010, 21:28
It's a well known issue to me. Wink It refers to the scopes of the namespaces: in the second code example 'jmp .toto' instruction and '.toto:' label belong to the two separate namespaces because you declare structure with a "global" name 'Z' which separates them. Use '.Z' instead.

This code compiles OK:
Code:
include 'win32a.inc' 

jmp  .toto 

struct .Z 
   v dd ? 
ends 

.toto:     


Last edited by MHajduk on 02 Oct 2010, 21:29; edited 1 time in total
Post 02 Oct 2010, 21:28
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 02 Oct 2010, 21:29
"struct" macro defines some labels, here for example "Z". And labels starting with dot are local to the most recent global label (the one not starting with dot). See manual, section 1.2.3, near the end.
Post 02 Oct 2010, 21:29
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 02 Oct 2010, 21:33
As you can see TG confirmed what I wrote above. Wink
Post 02 Oct 2010, 21:33
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 02 Oct 2010, 22:14
Code:
indeed this does compile with ".Z"
-----------------------------------

jmp  .toto

struct .Z 
   v dd ? 
ends 

.toto:
    

ok, thank you MHajduk, thank you Tomasz. Razz

i'm working hard on next wink, many changes !
management of data_labels (label db/dd/ rb/rd .....)
management of "struct" ... and "macro"<-- for bitRAKE Wink
Data_label management is complex, for example,
to mention just one of many problems ...
locals / x dd ? / endl
struct/ x dd ?/ends
... Razz
Quote:

The label whose name begins with dot is treated as local label, and its name
is attached to the name of last global label (with name beginning with
anything but dot) to make the full name of this label. So you can use the
short name (beginning with dot) of this label anywhere before the next global
label is defined, and in the other places you have to use the full name. Label
beginning with two dots are the exception - they are like global, but they
don't become the new prefix for local labels.
Tomasz, i know that by heart
I dream of that even during the night ! Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Oct 2010, 22:14
View user's profile Send private message Send e-mail 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.