Thread overview
Documentation error - array structure definition
Jul 16, 2004
Matthew Wilson
Jul 16, 2004
Stewart Gordon
Jul 16, 2004
Matthew Wilson
Jul 16, 2004
Matthew
Jul 17, 2004
Walter
July 16, 2004
The http://www.digitalmars.com/d/abi.html page says:

A dynamic array consists of:
    0: pointer to array data
    4: array dimension

This is arse-about-face, surely? If it's correct, then I've got some seriously helpful magic imps helping me out on code interfacing between C and D

Yours, puzzled.

Dr Proctor


July 16, 2004
Matthew Wilson wrote:

> The http://www.digitalmars.com/d/abi.html page says:
> 
> A dynamic array consists of:
>     0: pointer to array data
>     4: array dimension
> 
> This is arse-about-face, surely? If it's correct, then I've got some
> seriously helpful magic imps helping me out on code interfacing between C
> and D

Would you care to elaborate?

Stewart.

-- 
My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment.  Please keep replies on the 'group where everyone may benefit.
July 16, 2004
Well, the Open-RJ header defines a string as:

struct ORJStringA
{
    size_t      len;        /*!< The number of characters in the string
*/
    char const  *ptr;       /*!< Pointer to the first element in the string
*/
};

The lib links and runs with D, treating the ORJStringA as char[], seamlessly.


"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:cd8cju$4ce$2@digitaldaemon.com...
> Matthew Wilson wrote:
>
> > The http://www.digitalmars.com/d/abi.html page says:
> >
> > A dynamic array consists of:
> >     0: pointer to array data
> >     4: array dimension
> >
> > This is arse-about-face, surely? If it's correct, then I've got some seriously helpful magic imps helping me out on code interfacing between
C
> > and D
>
> Would you care to elaborate?
>
> Stewart.
>
> -- 
> My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment.  Please keep replies on the 'group where everyone may benefit.


July 16, 2004
Of course, a simpler way of looking at it is that fmt specifiers for D strings are %.*s. In C, one would write the args as printf("%.*s\n", len, ptr);

"Matthew Wilson" <admin.hat@stlsoft.dot.org> wrote in message news:cd8e0l$56v$1@digitaldaemon.com...
> Well, the Open-RJ header defines a string as:
>
> struct ORJStringA
> {
>     size_t      len;        /*!< The number of characters in the string
> */
>     char const  *ptr;       /*!< Pointer to the first element in the string
> */
> };
>
> The lib links and runs with D, treating the ORJStringA as char[], seamlessly.
>
>
> "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:cd8cju$4ce$2@digitaldaemon.com...
> > Matthew Wilson wrote:
> >
> > > The http://www.digitalmars.com/d/abi.html page says:
> > >
> > > A dynamic array consists of:
> > >     0: pointer to array data
> > >     4: array dimension
> > >
> > > This is arse-about-face, surely? If it's correct, then I've got some seriously helpful magic imps helping me out on code interfacing between
> C
> > > and D
> >
> > Would you care to elaborate?
> >
> > Stewart.
> >
> > -- 
> > My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment.  Please keep replies on the 'group where everyone may benefit.
>
>


July 17, 2004
"Matthew Wilson" <admin.hat@stlsoft.dot.org> wrote in message news:cd8177$305n$1@digitaldaemon.com...
> The http://www.digitalmars.com/d/abi.html page says:
>
> A dynamic array consists of:
>     0: pointer to array data
>     4: array dimension
>
> This is arse-about-face, surely? If it's correct, then I've got some seriously helpful magic imps helping me out on code interfacing between C and D

The doc is wrong. I'll fix it.