Can we disallow appending integer to string?
XavierAP via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 21 01:17:54 PDT 2017
On Wednesday, 19 April 2017 at 14:50:38 UTC, Stanislav Blinov
wrote:
> On Wednesday, 19 April 2017 at 14:36:13 UTC, Nick Treleaven
>>
>> Why is it legal to append an integer?
>
> Because integrals implicitly convert to characters of same
> width (byte -> char, short -> wchar, int -> dchar).
Huh... I hadn't used but I'd been assuming probably biased from
C# that
str ~ i
would be equivalent to
str ~ to!string(i)
instead of
str ~ cast(char) i
Now I see the problem too...
More information about the Digitalmars-d-learn
mailing list