Would you like signs with those chars?
Would you like signs with those chars?
Posted Oct 25, 2022 7:39 UTC (Tue) by matthias (subscriber, #94967)In reply to: Would you like signs with those chars? by SLi
Parent article: Would you like signs with those chars?
In this case, there is no overflow. Subtracting 1 from 0xff is non-overflowing regardless of whether the type is signed or unsigned. If it is signed, the result is -2 (0xfe) And in both cases, the result is well within the bounds of an int. The difference is whether it gets sign-extended (signed char) or not (unsigned char).
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
