News for hackers. Stuff that matters.
Re:Fast integer overflow detection (2012) by acqq on Sunday December 14, 2014 @09:07PM (#8750385)
Nice, with the conditional operator and a single return it's even terser:

    bool is_safe_to_add_ints( int a, int b ) {
        return b < 0 
               ? a >= INT_MIN - b 
               : a <= INT_MAX - b;
    }

There are no comments on this comment yet.