Several questions (about inline assembly, ddoc for templates, and foreach)
Marcio
m.faustino at gmail.com
Sat Aug 19 13:16:43 PDT 2006
Chris Nicholson-Sauls wrote:
> Huh. I could've sworn it used to work that way... but no matter, I just wrote the
> following and it worked fine (DMD 0.164):
> (...)
> Turns out the 'inout' isn't neccessary anyhow. This prints, as I expected:
> (...)
Thanks! It must've been my fault, perhaps I was doing something wrong and I
couldn't get it to work.
Thomas Kuehne wrote:
> It's implemntation dependent. Phobos, GPhobos and Ares currently use
>
> # struct Array{
> # size_t len;
> # void* ptr;
> # }
>
> Thus you could write(32-bit systems only):
>
> # asm {
> # mov EAX, [array + 4]
> # }
Just tested the following code, using DMD v0.164 (in Linux), and it didn't work:
//----------------------------------------------------
void main() {
static uint[3] array = [0xC0DE, 0xBEEF, 0xF00D];
uint* a = null;
asm {
mov EAX, [array + 4];
mov a, EAX;
}
writefln(a); // Prints: BEEF
}
//----------------------------------------------------
Any ideas?
More information about the Digitalmars-d-learn
mailing list