www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Documentation error - array structure definition

reply "Matthew Wilson" <admin.hat stlsoft.dot.org> writes:
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
Jul 16 2004
next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
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.
Jul 16 2004
parent reply "Matthew Wilson" <admin.hat stlsoft.dot.org> writes:
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.
Jul 16 2004
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
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.
Jul 16 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
"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.
Jul 16 2004