3 ms·
Signed and unsigned are actually treated internally the same on computers. The reason you see -2 printed out when you add signed chars -1 and -1 together is be
by AnotherGoodName 5y ago
Signed and unsigned are actually treated internally the same on computers.
The reason you see -2 printed out when you add signed chars -1 and -1 together is because adding 255 and 255 together gives 254 under mod 256. The signed model that allows negative numbers relies on the fact that all numbers on computers are modular arithmetic.
So in that sense any argument that unsigned is modular and signed isn't is incorrect. You're better off choosing the one that forces you to consider how the computer actually operates under the hood.
- jcelerier 5y ago> Signed and unsigned are actually treated internally the same on computers. if you are writing code in C or C++ the computer you are programming for is the C / C++ abstract machine. C++ recently sanctified complement-of-two as integer representation, but C does not and supports machines with one's complement representation.
- deleted 5y ago[deleted]