flat assembler
Message board for the users of flat assembler.

Index > Main > error: symbol 'size?0' out of scope

Author
Thread Post new topic Reply to topic
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 12 Jul 2015, 11:50
;tst.asm
macro tst {
local size
if size
display 'size '
end if
size = 1
; size = 2
if size
display 'size '
end if
}
db 9,9,9
tst

$ fasm hello.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)
size size
2 passes, 3 bytes.

;tst.asm
macro tst {
local size
if size
display 'size '
end if
size = 1
size = 2
if size
display 'size '
end if
}
db 9,9,9
tst

$ fasm hello.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)
size
hello.asm [28]:
tst
hello.asm [18] tst [2]:
if size
error: symbol 'size?0' out of scope.

Who will tell me what is the reason?
Post 12 Jul 2015, 11:50
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Jul 2015, 12:41
For a single variable declaration you can forward reference it.

For multiple variable declarations you can only post-reference them.

BTW this is not a macro thing. It is the same when used outside of macros also.
Post 12 Jul 2015, 12:41
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 12 Jul 2015, 13:41
revolution wrote:
For a single variable declaration you can forward reference it.

For multiple variable declarations you can only post-reference them.

BTW this is not a macro thing. It is the same when used outside of macros also.




;tst.asm

if size
display 'size '
end if
size = 1
size = 2 ;<---- here

if size
display 'size '
end if

db 9,9,9


$ fasm hello.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)
size
hello.asm [3]:
if size
error: symbol 'size' out of scope.

You are very right! Well I suggest improvements to macros FASM.and always feel with illogical places.
thank revolution!
Post 12 Jul 2015, 13:41
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 12 Jul 2015, 13:47
$ fasm hello.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)
size
hello.asm [3]:
if size
error: symbol 'size' out of scope.

I say is improved if statement problem.
Post 12 Jul 2015, 13:47
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 12 Jul 2015, 13:57
You are very right! But I suggest improving FASM, and always feel is unreasonable.
Post 12 Jul 2015, 13:57
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Jul 2015, 14:31
What is your suggestion for the new message?
Post 12 Jul 2015, 14:31
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 12 Jul 2015, 14:49
1. improving the if statement, the following compile:

if size
display 'size '
end if
size = 1
size = 2 ;<---- always feel is unreasonable

if size
display 'size '
end if

db 9,9,9

2. Add a new warning, put the following into other, easy to understand meaning.
error: symbol 'size' out of scope.


have something new in mind, I have news to tell you.
Post 12 Jul 2015, 14:49
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Jul 2015, 15:23
This is not an issue with "if". It affects anything that uses the variable before it is defined.
Code:
display size   ;<--- okay
size = '0'    
Compare to:
Code:
display size   ;<--- what value to display?
size = '0'
size = '1'   ;<--- redefined    
Post 12 Jul 2015, 15:23
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 12 Jul 2015, 21:48
hank you revolution! I use FASM levels but also improve some!

display size ;<--- what value to display?
size = '0'
size = '1' ;<--- redefined

$ fasm hello.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)

hello.asm [1]:
display size ;<--- what value to display?
error: symbol 'size' out of scope.

thank you so much for your help!
Post 12 Jul 2015, 21:48
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.