I just saw this code here.
int32_t safe_div_int32_t (int32_t a, int32_t b) {
if ((b == 0) || ((a == INT32_MIN) && (b == -1))) {
report_integer_math_error();
return 0;
} else {
return a / b;
}
}
Just wondering what is wrong with the division (a/b) when a = INT32_MIN and b = -1. Is it undefined? If so why?