struct vs. class, int vs. char.

MLT none at anon.com
Tue Apr 28 11:02:41 PDT 2009


Steven Schveighoffer Wrote:

> BTW, this behavior you noticed is only on certain OSes.  On other OSes (I  
> think windows), you get weird behavior:
> 
> char[] x = "1234";
> x[0] = '4'; // no runtime error
> char[] y = "1234"; // y actually now equals "4234"!
> 
> -Steve

Pretty nice. It would be even nicer if you had the following:

char[] x = "1234";
x[0] = '4'; // no runtime error
char[] y = "12"; // y now equals "42"

;)





More information about the Digitalmars-d mailing list