ketmar:

this code: std.conv.parse!byte("-128") throws error: "Overflow in integral conversion". but this is obviously not true, as signed byte can hold such value.

the question is: is it bug, or it's intended behavior to limit signed integrals to values which can be safely abs()ed?

This code works to me:

void main() {
    import std.conv: to, parse;
    auto s1 = "-128";
    assert(s1.parse!byte == -128);
    immutable s2 = "-128";
    assert(s2.to!byte == -128);
}


What's your compiler version?

Bye,
bearophile

Reply via email to