2 ms·
I think overflow occurs when w * h > SIZE_MAX So you just want to make sure that w > 0 and w * h <= SIZE_MAX. But if w * h is large enough, it overflows, w
by meuk 8y ago
I think overflow occurs when
w * h > SIZE_MAX
So you just want to make sure that w > 0 and w * h <= SIZE_MAX. But if w * h is large enough, it overflows, which would result in w * h <= SIZE_MAX being evaluated to true.
I agree that it is confusing though.