Why implicit conversion of string literal to char[] does not works?
Dicebot
public at dicebot.lv
Tue Jul 2 06:39:35 PDT 2013
On Tuesday, 2 July 2013 at 13:33:10 UTC, Michal Minich wrote:
> Ok I understand. What I did as a first thing when I get error
> on "char[] x = "a" was "char x = cast(char[])"a", Which was
> obviously incorrect - as the "a" was/should be placed in rom.
> So if this expression is allays wrong - casting string literal
> to mutable, then compiler should emit an error on this
explicit cast means a order from a programmer "type system, I
know what I am doing, don't even try to bother me". You should
never use casts to simply suppress errors (unless absolutely
sure) in the very first place.
More information about the Digitalmars-d-announce
mailing list