Strange implicit conversion integers on concatenation
uranuz
neuranuz at gmail.com
Mon Nov 5 15:36:31 UTC 2018
Hello to everyone! By mistake I typed some code like the
following without using [std.conv: to] and get strange result. I
believe that following code shouldn't even compile, but it does
and gives non-printable symbol appended at the end of string.
The same problem is encountered even without [enum]. Just using
plain integer value gives the same. Is it a bug or someone realy
could rely on this behaviour?
import std.stdio;
enum TestEnum: ulong {
Item1 = 2,
Item3 = 5
}
void main()
{
string res = `Number value: ` ~ TestEnum.Item1;
writeln(res);
}
Output:
Number value:
More information about the Digitalmars-d
mailing list