implicit conversions between array and pointer
terranium
spam at here.lot
Sat Apr 26 12:08:57 PDT 2008
> You must be looking at a terribly out-of-date spec.
>
> http://www.digitalmars.com/d/1.0/arrays.html
>
> See the "Implicit conversions" section. As was mentioned, implicit
> conversion from T[] to T* was removed more than a year ago.
this section is for objects - reference types, I'm talking about value types. Look at sections Usage and Strings.
int* p;
int[3] s;
int[] a;
p = s; // p points to the first element of the array s.
p = a; // p points to the first element of the array a.
char[] str;
char* p = str; // pointer to 1st element
Of course array of ref types can't be converted to pointer to this ref type because D doesn't support pointers to ref types.
More information about the Digitalmars-d
mailing list