flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > push eax+5

Author
Thread Post new topic Reply to topic
Mr_Silent



Joined: 25 Apr 2006
Posts: 30
Mr_Silent
...compiles into
Code:
push eax
push 5
    

Is this normal? (I couldn't find this behavour in manual)
Post 04 Feb 2007, 14:12
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
The "+" here is working as word separator and sign specifier at the same time, the same happens with "-".

This also happens when you declare a macro like this way

Code:
macro aMacro[args] ; No space between "aMacro" and "["
{}    
Post 04 Feb 2007, 15:18
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Mr_Silent: this is because of "hack" to syntax, to allow commands like this:
Code:
push eax ebx ecx    
.

Drawback is that "push eax+5" is then same as "push eax +5", and "+" is both unary and binary operator.
Post 04 Feb 2007, 16:51
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
IceStudent



Joined: 19 Dec 2003
Posts: 60
Location: Ukraine
IceStudent
Dangerous feature..

Code:
push edx+5  ; push edx, push 5
push dword[edx+5]  ; push [edx+5]
push buf+5  ; push buf+5    


1st push - an exception from the common syntax and we must remember it (hello, C language). But in the macro it can be hidden from eyes and became a potentially error.
Post 17 Feb 2007, 09:43
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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.