2 ms·
In theory it might be possible to avoid trap representations for _Bool if one would specify that it would be like other unsigned integer types, i.e. 0 is false
by jabl 10y ago
In theory it might be possible to avoid trap representations for _Bool if one would specify that it would be like other unsigned integer types, i.e. 0 is false and non-zero is true, instead of the current situation where 0 is false, 1 is true and anything else is a trap representation.
Now this would break at least one possible optimization that at least GCC does, namely that if you know that the value is either 1 or 0, then "!x" can be implemented as "x^1" (bitwise xor the value with 1) instead of a branch. I'm not sure that this optimization is particularly significant in real world code, though.