mixin assembler does not work?
Foo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 20 07:50:35 PDT 2014
On Sunday, 20 July 2014 at 14:46:32 UTC, bearophile wrote:
>> enum Vala(uint count, alias arr) = format("
>> asm {
>> sub ESP, %d; // Reserve 'count' bytes
>> mov %s, %d; // Set a.length = 'count'
>> mov %s + 4, ESP; // Set &a[0] to reserved bytes
>> }", count, arr.stringof, count, arr.stringof);
>
> I'd like to write that more like this:
>
>
> enum Vala(uint count, alias arr) = format("
> asm {
> sub ESP, %%(count); // Reserve 'count'
> bytes
> mov %%(arr.stringof), %%(count); // Set a.length =
> 'count'
> mov %%(arr.stringof) + 4, ESP; // Set &a[0] to
> reserved bytes
> }");
>
>
> See:
> http://fslang.uservoice.com/forums/245727-f-language/suggestions/6002107-steal-nice-println-syntax-from-swift
>
> Bye,
> bearophile
It seems that your code doesn't work with 2.065.
More information about the Digitalmars-d-learn
mailing list