flat assembler
Message board for the users of flat assembler.

Index > Main > multiple operator bug

Author
Thread Post new topic Reply to topic
geppy



Joined: 06 Jan 2009
Posts: 16
geppy
multiple operator bug, version 1.68

the following compiles
mov eax, 3++6
mov eax, 3-+6
mov eax, [rsi+rax*-+8]
I didn't investigate what the result will be

obviously nobody would write such expressions but I just happened to make mistake with ++ and fasm allowed it
Post 18 Jun 2009, 04:04
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2888
Location: [RSP+8*5]
bitRAKE
Imagine some of those expressions might result from macro expansion, and hence are valid input.
Post 18 Jun 2009, 04:47
View user's profile Send private message Visit poster's website Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
Location: Severodvinsk, Russia
SFeLi
Code:
3-+6 = 3 - (+6) ; Binary -, unary +. C allows this too.
3++6 = 3 + (+6) ; Binary +, unary +. C doesn’t allow this,
                ; but allows 3+ +6. Fasm doesn’t have unary ++
                ; operator, so it is ok to allow this without
                ; spaces (as well as 3--2 etc.).    
Post 18 Jun 2009, 06:34
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
geppy



Joined: 06 Jan 2009
Posts: 16
geppy
hell, regardless what C creators think there is no way you can persuade me that to be acceptable. There is too much assumption has to be made.

What about multiplication and 3 in a row operators my C expert?
mov eax, 8*-+7


Last edited by geppy on 18 Jun 2009, 07:01; edited 1 time in total
Post 18 Jun 2009, 06:48
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7712
Location: Kraków, Poland
Tomasz Grysztar
geppy wrote:
What about multiplication my C expert?

Well, in fact, "i*-+8" is going to work in C, too. Because both "-" and "+" are unary operators, you are free to use them as much as you want.

Moreover, "i*+-8" is going to work in C, too - but it's not working in fasm, because fasm accepts "+" only immediately next to number. So, if there's any bug to fix, it's to make "+" a fully supported unary operator, just like "-" is. Though I don't think it's really so important.
Post 18 Jun 2009, 07:01
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.

Powered by rwasa.