mixin assembler does not work?

Foo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 20 07:53:59 PDT 2014


On Sunday, 20 July 2014 at 14:44:07 UTC, sigod wrote:
> On Sunday, 20 July 2014 at 14:18:58 UTC, Foo wrote:
>> template Vala(uint count, alias arr) {
>> 	immutable string c = to!string(count);
>>
>> 	enum Vala = "asm { sub ESP, " ~ c ~ "; mov " ~ arr.stringof ~ 
>> ",
>> " ~ c ~ "; mov " ~ arr.stringof ~ " + 4, ESP; }";
>> }
>> ...
>> 		mixin Vala!(1000, a);
>
> I'm not sure how to do it, but I see few mistakes in your code:
>
> 1. You declaring it as a string. (Or your intend to use 
> `mixin()`?)
> 2. You trying to use `template` as a [`mixin template`][0].
>
> [0]: http://dlang.org/template-mixin

Yeah, it now works with mixin(Vala!(1000, a)); I thought that 
both are the same.


More information about the Digitalmars-d-learn mailing list