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

Daniel Murphy yebblies at nospamgmail.com
Thu Mar 8 05:48:28 PST 2012


"Denis Shelomovskij" <verylonglogin.reg at gmail.com> wrote in message 
news:jj9uv1$8o$1 at digitalmars.com...
> 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?
>

I'm pretty sure dmd splits up all asm block into bunches of asm statements 
internally, so you should be able to rely on this. (dmd only)  I don't think 
it's documented anywhere.




More information about the Digitalmars-d-learn mailing list