Disallow arrays as pointers

Don nospam at nospam.com
Wed Nov 9 05:42:24 PST 2011


On 07.11.2011 10:45, Dejan Lekic wrote:
> Don wrote:
>
>>
>> It was a bug. And it's now been fixed.
>
> Don, care to explain why? If I want to treat D's array like I would do in C,
> why not allow me do so?

I had no involvement with it at all.

Although, when we originally banned implicit conversions from arrays to 
pointers, it was because it was _the_ most common bug in D code. 
Especially when you pass a char[] array to an extern(C) function that 
accepts a char *. It really was a disaster.

Just add .ptr if you want to convert it to a pointer. It's beautiful, 
really.


More information about the Digitalmars-d mailing list