flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > forward & reverse behaviour

Author
Thread Post new topic Reply to topic
Ancient One



Joined: 28 Feb 2005
Posts: 55
Ancient One
i hope this is the right section for this kind of question.

i notice that the "forward" and "reverse" macro directives, when used in macros that are not defined to received block arguments, will be processed once. This is ok. But when used in macros that are defined to received block arguments, it will be processed at least once, even if no arguments are given in macro invocation. For example :

Code:
macro greedyMacro [arg] {
forward
  db arg
}
    


if called with > 0 arguments will be processed correctly :

Code:
greedyMacro 0, 1, 2
    


but I think it shouldn't be processed at all if no arguments are given for the block argument. For example, calling greedyMacro with no arguments should make the forward block not processed at all.
Code:
greedyMacro
    


what u do think?
Post 10 May 2005, 06:18
View user's profile Send private message MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
This will do what you want.

Code:
macro greedyMacro [arg] { 
common
if ~ arg eq
forward 
  db arg 
common
end if
} 
    
Post 11 May 2005, 03:07
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.