Non-immutable char[] doesn't change?

Salih Dincer salihdb at hotmail.com
Sat Aug 18 04:35:55 PDT 2012


So, that's not this a bug?

   char[] a = [ 'a', 'b', 'c' ];
   char[] b = cast(char[])"abc";

   assert(a == b);       /* no problem! */
   assert(typeid(a) ==
          typeid(b));    /* no problem! */

// v--- TOGGLE CODE
   //a[0] = 'A';         /*
   b[0] = 'A';           /* there is problem:
                          * Segmentation fault
                          */

Thanx...


More information about the Digitalmars-d-learn mailing list