[Inline assembler] Sequential `asm` blocks and return via EAX

Denis Shelomovskij verylonglogin.reg at gmail.com
Thu Mar 8 01:42:50 PST 2012


1. Is there any guaranties that no code will be added between sequential 
inline assembler blocks, e.g.:
---
void f()
{
     static if(x)
         asm { mov EBX, 3; }
     else
         asm { mov EBX, 7; }

     asm { mov EAX, EBX; } // Is EBX value defined here?
}
---
Is it documented?


2. Such question about return via EAX (is the following use 
legal/documented):
---
int g()
{
     asm { mov EAX, 4; }
}
---
Such use of `asm` to return a value is used here and there in 
http://dlang.org/iasm.html


More information about the Digitalmars-d-learn mailing list