operator "~" does not check type?
bearophile
bearophileHUGS at lycos.com
Wed Oct 12 00:53:22 PDT 2011
Jonathan M Davis:
> int and dchar implicitly convert to one another for better or for worse.
> Personally, I'd prefer that they didn't, but that's the way that it is, so I
> don't believe that this is technically a bug.
char->int is OK, but int->char is not so OK. This programs (that compiles with no errors) seems to show a possible source of bugs, so I call this a design bug, worth fixing:
void main(string[] args) {
int x = args.length;
string s = "hello";
s ~= x;
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list