cstrings
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jan 2 03:12:13 PST 2011
On Saturday 01 January 2011 20:12:31 Ellery Newcomer wrote:
> are there any other cstring -> dstring functions than to!string(char*) ?
>
> something like to!(char[])(char*)
>
> (the memory allocation bothers me)
to!(char[])() should work just fine, but I believe that you're going to have to
have a memory allocation regardless, since a D array can't refer to an arbitrary
pointer. A D array and a C/C++ array are two different different things, even
though a D array uses a C/C++ array internally. A D array is able to be resized
and reallocated and the like in a way that a C/C++ array can't be.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list