On 2021-12-11, Michael Forney <[email protected]> wrote: > Conversion of unsigned char values outside the range of char is > implementation defined by C99 6.3.1.3p3: > >> Otherwise, the new type is signed and the value cannot be represented >> in it; either the result is implementation-defined or an >> implementation-defined signal is raised.
Also worth noting, this clause still remains even in the current C23 draft, which requires two's complement. So, assuming that CHAR_MAX == 127, (char)0xFD will continue to be implementation defined and might raise a signal. This is different from C++, which went a step further to define conversion between all integer types to be the unique value congruent to 2^N (where N is the number of bits of the destination type).
