why is string not implicit convertable to const(char*) ?

Timon Gehr timon.gehr at gmx.ch
Thu Jul 5 12:59:54 PDT 2012


On 07/05/2012 09:32 PM, dcoder wrote:
>
> Thanks for the thorough explanation, but it begs the question why not
> make strings be array of chars that have \0 at the end of it?

Because that is inefficient. It disables string slicing and is 
completely redundant.

BTW: String literals are guaranteed to be zero-terminated.

> Since, lots of D programmers were/are probably C/C++ programmers, why should D
> be different here?

Because it is a superior model.

> Wouldn't it facilitate more C/C++ programmers to come to D?
>

Why would that matter?


More information about the Digitalmars-d-learn mailing list