In practice, the most common behavior is that the high-order bits are discarded. (Or an implementation-defined signal can be raised, but I don't know of any compilers that do this.) According to the ISO C standard, when you convert an integer to a signed type, and the value is outside the range of the target type, the result is implementation-defined.
0 Comments
Leave a Reply. |