const?? When and why? This is ugly!

novice2 sorry at noem.ail
Tue Mar 3 21:55:18 PST 2009


Denis Koroskin Wrote:

> // file 1
> char[] a = "hello";
> a[4] = '!';
> 
> // file 2
> writefln("hello"); // prints 'hell!'


bad example :)
why so behaviour? imho, it may be occur bacause of bad compiler design only. like C compiler for space optimization collect all mentioning of similar strings and allocate only one for all of occurence. and even in this case it must allocate it in non-writable memory section.



More information about the Digitalmars-d mailing list