On Wednesday, 4 November 2015 at 07:59:44 UTC, Ali Çehreli wrote:
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
wow, this I don't understand at all, how do those two operations
connected to each other? By the bool value?