I think that what's happening is that according to the obscure (to me, anyway) integral promotion rules, in the expression "a * b", the short int quantities a and b are both converted to int before the multiplication, so there is no overflow in this case. I think that if a and b were of type int, and the product of a and b was too big for an int but not for a size_t (for example on a 64-bit machine where int is 32 bits and size_t is 64 bits), then it would overflow with sizeof at the end, but not at the beginning (I'm not 100% sure since I'm still vague on the integral promotion rules). Can someone try it?

