flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Compiler Internals > [fasmg] err doesn't terminate source processing

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 419
Location: Belarus
[fasmg] err doesn't terminate source processing
Consider the following macro

Code:

macro my? args&
  local flags
  define flags args
  match =a moreflags :
    display 'a'
    redefine flags more
  else match =b moreflags :
    display 'b'
    redefine flags more
  else
    err 'error'
  end match
  while 1
    match :, flags
      break
    end match
  end while
end macro

my c




It enters infinite while loop despite first match should have terminated it with error.

Code:

redefine flags :



should be explicitely added to else statement for macro to work. I thought that err should terminate source code processing with error
Post 06 Mar 2017, 21:28
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
Re: [fasmg] err doesn't terminate source processing

zhak wrote:
I thought that err should terminate source code processing with error

It was this way in fasm 1 but not in fasmg. There are no instant-termination errors in fasmg other than running out of memory. The ERR just collects an error to display (fasmg allows to display multiple errors collected from an entire source). If you write a loop that is at risk of running endlessly, you need to put some safety breaks there yourself.

The thing is: since fasmg allows anything, including symbolic variables and macros, to be forward-referenced, any kind of error might be a false alarm. For this reason the assembler always needs to continue processing, because the error may go away when more values get resolved (just like the arithmetic overflow in fasm 1 did not abort the assembly because it could disappear in a subsequent pass).
Post 06 Mar 2017, 22:17
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.