flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > FASMG: suprising behavior of 'definite' operator ?

Author
Thread Post new topic Reply to topic
fabbel



Joined: 30 Oct 2012
Posts: 83
fabbel 12 Feb 2024, 15:31
Hi Tomasz,

Am a bit suprised by below behavior of definite operator... would u pls help clarify ?
.... below code displays 'DEFINITE'... looks pretty odd to me..
... would have expected the opposite considering local uninitialized variable ...


Code:
calminstruction test
        local _tmp

                check definite _tmp
                jyes @def

                display 'not DEFINITE'
                jump @end

        @def :
                display 'DEFINITE'

        @end:
                display 13
                display 10
end calminstruction

test
    
Post 12 Feb 2024, 15:31
View user's profile Send private message Reply with quote
fabbel



Joined: 30 Oct 2012
Posts: 83
fabbel 12 Feb 2024, 15:37
... actually, looking back at the manual, I see it says
Quote:

A symbol made local is initally assigned a defined but unusable value.


.. so that would pbly explain it...
... but still, that really feels strange nonetheless...
Post 12 Feb 2024, 15:37
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 12 Feb 2024, 16:31
Yes, it's a quirk of how locality is enforced without altering the existing fasmg's symbol recognition engine. The symbol needs to have a value to be "seen" by the ALM compiler, but it is given a value of type that is unusable by design (so for example TAKE command does not consider it a valid value). I was designing CALM on top of the existing rules and trying to make the best use of what I already had.

Also, be careful: once the symbol is given a symbolic value (a text from an argument, etc.), DEFINITE is going to look inside the value and check the status of a symbol with name embedded there, and not the "proxy" symbol itself.
Post 12 Feb 2024, 16:31
View user's profile Send private message Visit poster's website 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.