Hacker News new | ask | show | jobs
by fwsgonzo 945 days ago
If you use MSVC maybe it's more of an issue, but on GCC and Clang we have __builtin_overflow_*. There are many variants: https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins...

I use them all the time.

1 comments

When you have wrappers over these that produce optional types, and use statement expression macros or monadic member functions to handle the control flow, I think it's not too hard.