flat assembler
Message board for the users of flat assembler.

Index > Main > [fasmg] Confusing namespace behaviour

Author
Thread Post new topic Reply to topic
Calanor



Joined: 19 Jul 2015
Posts: 45
Location: Sweden
Calanor 08 Sep 2022, 15:35
OK, perhaps I am missing something obvious here, but this little test left me a bit confused:
Code:
testlabel.testing:
namespace .
        jmp testing._done
_done:
        retn
end namespace    

I would have assumed that the jump would refer to "testlabel.testing.testing._done", but fasmg treats it as if it is about to jump to ""testlabel.testing._done". Of course, fasmg also accepts "jmp _done". If I change "testing" in the jump to "lala", the compiler will complain about not recognising ""testlabel.testing.lala._done". As expected of course, but why is it OK with "testing._done"?
Post 08 Sep 2022, 15:35
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 08 Sep 2022, 16:26
When looking for a namespace, fasmg always searches for a defined symbol. In this case, when it looks for "testing" namespace, it first looks for "testlabel.testing.testing", but there is no such symbol defined, so it continues search in the parent namespace, finding "testlabel.testing". Only if it did not find any defined symbol at all, it would fall back to the symbol in current namespace.
Post 08 Sep 2022, 16:26
View user's profile Send private message Visit poster's website Reply with quote
Calanor



Joined: 19 Jul 2015
Posts: 45
Location: Sweden
Calanor 08 Sep 2022, 16:51
That clears things up! Thanks, Tomasz!
Post 08 Sep 2022, 16:51
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.