On 11/03/2015 11:52 PM, Namal wrote:

http://dlang.org/phobos/core_checkedint.html

It says:


"The overflow is sticky, meaning a sequence of operations can be done
and overflow need only be checked at the end."

But how can I make multiple operations? I can only put 2 values in the
function.

import core.checkedint;

void main() {
    bool overflowed;
    auto result = adds(int.max, 1, overflowed); // this overflows
    adds(1, 2, overflowed);     // this does not reset the flag

    assert(overflowed);
}

Ali

Reply via email to