Would you like signs with those chars?
Would you like signs with those chars?
Posted Oct 24, 2022 21:14 UTC (Mon) by NYKevin (subscriber, #129325)In reply to: Would you like signs with those chars? by cesarb
Parent article: Would you like signs with those chars?
More to the point, it better matches reality. A byte is 8 bits, not a number. You can use it to store numbers, but in practice it will be a component of a short or int (or a UTF-8 code point sequence, which sometimes might happen to only be one byte long), not a number in its own right. I don't visualize bytes as getting magically sign-extended when I do bitwise operations on them, and I pretty much never use char for math or counting things. I suppose there might be some situations where you really are extremely sure that you'll never need to count higher than 127 or lower than -128, but it's difficult to imagine a specific example (that does not involve the phrase "for historical reasons").
