flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > local label names conflict

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 412
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 23 Dec 2022, 15:19
Code:
Name?0:

macro test
{
local Name
Name: mov eax,Name ;<- symbol already defined
}

test    

_________________
smaller is better
Post 23 Dec 2022, 15:19
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8344
Location: Kraków, Poland
Tomasz Grysztar 23 Dec 2022, 17:32
It's a limitation of the multi-layered architecture of fasm 1, where the preprocessor needs to generate identifiers for local labels that are then passed to parser/assembler. Whatever the rule would be used to form these names, you would be able to collide with them manually, because the text generated by preprocessor is the same kind of text that you could just input directly. This is easily demonstrated by PREPSRC tool, which generates a text that can be normally assembled by fasm.

The new engine, used by fasmg, does not have this problem, as it has a true namespace separation by design.
Post 23 Dec 2022, 17:32
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 412
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 24 Dec 2022, 12:25
Can you replace the "?" for example ";" in local labels (one that cannot be "entered")?

_________________
smaller is better
Post 24 Dec 2022, 12:25
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8344
Location: Kraków, Poland
Tomasz Grysztar 24 Dec 2022, 12:33
It would break any uses that assume tokens to be correctly translatable back to text (like mentioned PREPSRC).
Post 24 Dec 2022, 12:33
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 412
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 24 Dec 2022, 12:38
It's hard, you can't have everything.

Thanks.
Post 24 Dec 2022, 12:38
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.