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

Sean Kelly sean at f4.ca
Sun Aug 20 11:49:28 PDT 2006


Thomas Kuehne wrote:
> -----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;
> # }

I think this is actually required.  According to the ABI 
(http://www.digitalmars.com/d/abi.html):

     Arrays
     A dynamic array consists of:

     offset   contents
     0        array dimension
     4        pointer to array data


Sean



More information about the Digitalmars-d-learn mailing list