Several questions (about inline assembly, ddoc for templates, and foreach)

Thomas Kuehne thomas-dloop at kuehne.cn
Sat Aug 19 12:08:47 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marcio schrieb am 2006-08-19:
> Chris Nicholson-Sauls wrote:
>> (...)
>> I'm not sure.  Of course, pending a real solution from someone who knows better,
> you could
>> do this:
>>
>> # void main () {
>> #   int[] array             ;
>> #   auto  ptr   = array.ptr ;
>> #
>> #   asm {
>> #     mov  EAX , ptr ;
>> #   }
>> # }
>
> Yes, that's what I'm doing currently.

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]
# }

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFE527pLK5blCcjpWoRAm6eAJ44HPK1AmaPJ6Zdair6dTd7rnbaGwCfT6oR
AgavCz0umlrBm+skjkL7H7I=
=7N6c
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-learn mailing list