Why implicit conversion of string literal to char[] does not works?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Tue Jul 2 07:26:53 PDT 2013


On Tuesday, 2 July 2013 at 13:51:15 UTC, Michal Minich wrote:
> As this cast (on linux), will _allways_ result in undefined 
> behavior. It is something compiler can  easily tell, and advice 
> "use .dup instead of cast..."

Casting away const/immutable is not undefined, modifying 
const/immutable data is. Since you cast away immutable the 
compiler can no longer prevent you from making such modifications.


More information about the Digitalmars-d-announce mailing list