Computer Systems: A Programmer’s Perspective, a textbook by Bryant and O’Halloran, is in its third edition and also its third decade of teaching students falsehoods about C
absolutely indefensible code. I mailed them about this years and years ago
switching over to codegen for overflow checking for addition, we don't appear to get optimal code for any of the obvious ways to do it, from latest GCC or LLVM, unless we use the intrinsic
@uecker reminded me that this C23 feature is a better choice than the intrinsic, and also results in optimal codegen https://gcc.godbolt.org/z/xP3reE9n8
@dalias @regehr @uecker some quick googling turned up this code here: https://github.com/jart/jtckdint uses the C23 intrinsics if available, otherwise has a dropin. is this what the youths call a polyfill?