mixin assembler does not work?

Nicolas Sicard via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 20 10:50:09 PDT 2014


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.


More information about the Digitalmars-d-learn mailing list