Even if it meant power, it would make sense to warn here, because storing 2^16 in an unsigned short yields 0 :-)
I code in C/C++ too, although not exclusively. I facepalmed a few seconds later, but it goes to show the value of having this be a compiler warning.
/edit: had that mixed up in my head. Interestingly, clang does warn about the overflow:
main.c:6:17: warning: implicit conversion from 'int'
to 'int16_t' (aka 'short') changes value from
65536 to 0 [-Wconstant-conversion]
int16_t s16 = 65536; -2^16 = (-2) ^ 16 = 0b111...1110 ^ 0b10000 = 0b111...11011110 = -18
if I'm not mistaken.But since philosophically a signed int has '1's in every bit from the MSB to infinity towards the left, it should thus be -0 not 0.