flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Suggestion/request

Author
Thread Post new topic Reply to topic
Joshua



Joined: 12 Jul 2003
Posts: 56
Location: Belgium
Joshua
Priv,

Instead of returning 'error: undefined symbol' on a line like the following, perhaps it is possible to initialise it to blank? (perhaps same for equ and fix)

Ex:
Code:
A = A + 1   -> Error       -> A =  + 1    -> A = 1
    
But this stays the same:
Code:
A = 5       -> A = 5
A = A + 1   -> A = 5 + 1   -> A = 6
    
And:
Code:
B = A + 1   -> Error
    

I know that this can in most cases be emulated with:
Code:
local here
if ~defined A | defined here
    A = 1
    here = 0
else
    A = A + 1
end if
    
But when using this as a counter it may return incorrect results as explained in this post:
http://board.flatassembler.net/topic.php?p=4322&highlight=#4322
Post 01 Aug 2004, 10:25
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7618
Location: Kraków, Poland
Tomasz Grysztar
The old "defined" behavior was good for this, but the with the new one (since 1.50) it's not possible. Maybe I should re-implement the old "defined" with some new name?
Post 01 Aug 2004, 10:58
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7618
Location: Kraków, Poland
Tomasz Grysztar
I've got a better idea: let the "defined" work the old way specifially with the redefined constants - this will make it even more logical, as those constants cannot be forward-referenced, too, so checking only for backward definition is indeed more suitable for them.

I'm currently testing whether it doesn't cause any problems, it solves your trouble with the code like:
Code:
if ~ defined a
 a = 0
end if
a = a + 1    
Post 01 Aug 2004, 11:33
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7618
Location: Kraków, Poland
Tomasz Grysztar
It seems that it works good. The 1.54 release has been updated to include this change. The new behavior of "defined" can be described simply as: it checks whether the symbol has been defined and is accessible from the current position.
Post 01 Aug 2004, 11:46
View user's profile Send private message Visit poster's website Reply with quote
Joshua



Joined: 12 Jul 2003
Posts: 56
Location: Belgium
Joshua
Perfect!
Post 01 Aug 2004, 23:52
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-2020, Tomasz Grysztar.

Powered by rwasa.