Hey guys. Can someone explain me, why this code does only works with the inline assembler version but not with the mixin? Thanks in advance!
Code: import std.stdio : writeln; import std.conv : to; 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; }"; } void main() { ubyte[] a; writeln(a.length); static if (false) { asm { sub ESP, 1000; // Reserve 1000 bytes mov a, 1000; // Set a.length = 1000 mov a + 4, ESP; // Set &a[0] to reserved bytes } } else { mixin Vala!(1000, a); } writeln(a.length); }