mixin assembler does not work?

Foo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 21 01:39:09 PDT 2014


On Sunday, 20 July 2014 at 17:50:10 UTC, Nicolas Sicard wrote:
> On Sunday, 20 July 2014 at 15:02:58 UTC, Foo wrote:
>> On Sunday, 20 July 2014 at 14:55:00 UTC, Foo wrote:
>>> For clarification: how would that work without mixin + string?
>>
>> I tried this:
>>
>> mixin template Vala2(uint count, alias arr) {
>> 	asm {
>> 		sub ESP, count;
>> 		mov arr, count;
>> 		mov arr + 4, ESP;
>> 	}
>> }
>>
>> but I get several errors. Unfortunately it seems that asm 
>> cannot be used in mixin templates?!
>
> The reason may be that mixin templates are just for inserting 
> declarations, which asm blocks aren't. This limitation isn't 
> specific to asm.

But what's the reason for that?


More information about the Digitalmars-d-learn mailing list