String Literals (D 2.0)

Xinok xnknet at gmail.com
Mon Jun 18 14:36:10 PDT 2007


I find this a bit annoying:
char[] str = "Test String";
Error: cannot implicitly convert expression ("Test String") of type 
invariant char[11] to char[]

Yet if you write:
int[] str = [10, 20, 30];
It gives no error.

I think the default behavior for string literals should be the same as 
array literals. And if the user does want a const or invariant string:
const str = "Test String";
invariant str = "Test String";



More information about the Digitalmars-d mailing list