News for hackers. Stuff that matters.
Re:A Quiz About Integers in C by klodolph on Monday June 04, 2012 @08:49PM (#4066778)
No, expanding a short to int or long is never unpredictable. The C standard guarantees that the expansion will only ever occur if the resulting type can represent all values in the original type, and that the result will always have the same value as the input.

If int is 32 bits and short is 16 bits, then converting unsigned short to int will always give a value in the range [0, 0xffff]. No exceptions.

There are no comments on this comment yet.