2 ms·
Most popular C compilers support trapping on integer overflow (i.e. https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-ftrapv https://gcc.gnu.org/on
by ndiddy 3y ago
Most popular C compilers support trapping on integer overflow (i.e. https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-ftrapv https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#ind...), but it does have some overhead as it replaces the native arithmetic instruction with a call to a library function (i.e. https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html#Trapping-arithmetic-functions https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routin...)