On 26.04.2011 15:21, Daniel Gibson wrote: > No, in D arrays are not just pointers. It's indeed a struct that > contains the length (arr.length) and the pointer (arr.ptr).
If this is a struct, then there is no "special compiler handling" needed to cast a struct to a pointer using opCast() (except for static arrays). But, from programmer point of view, array is not a struct, just a type with some properties, "struct" is hidden somewhere internally. > This makes arrays in D a lot safer and also easier to use than in C. I see no danger in using cast(void *)Array instead of Array.ptr, if semantic is known in advance (and it is). IMHO, it would be not so good if this handling will be disallowed at some point. /Alexander
