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

Alex Rønne Petersen xtzgzorex at gmail.com
Thu Mar 8 06:16:13 PST 2012


On 08-03-2012 14:48, Daniel Murphy wrote:
> "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.
>
>

I don't think it should be a formal language requirement either. It 
would be a rather harsh limitation on inline assembly implementations.

-- 
- Alex


More information about the Digitalmars-d-learn mailing list