mixin assembler does not work?
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 20 07:46:31 PDT 2014
> 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
More information about the Digitalmars-d-learn
mailing list