pub fn disable_panic_on_overflow() -> u64 
Expand description

Allows overflowing operations to occur without a FuelVM panic.

Additional Information

WARNING:

Don’t forget to call enable_panic_on_overflow or set_flags after performing the operations for which you disabled the default panic-on-overflow behavior in the first place!

Returns

  • [u64] - The flag prior to disabling panic on overflow.

Examples

use std::flags::{disable_panic_on_overflow, enable_panic_on_overflow};

fn main() {
    disable_panic_on_overflow();

    // Adding 1 to the max value of a u64 is considered an overflow.
    let bar = u64::max() + 1;

    enable_panic_on_overflow();
}
use std::flags::{disable_panic_on_overflow, set_flags};

fn foo() {
    let prior_flags = disable_panic_on_overflow();

    // Adding 1 to the max value of a u64 is considered an overflow.
    let bar = u64::max() + 1;

    set_flags(prior_flags);
}