Integer: Difference between revisions
m
→Signed/Unsigned
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 11:
==Signed/Unsigned==
Integer variables can be either be declared as '''signed''' or '''unsigned''', and this affects how the compiler handles them. CPUs have different ways of comparing values depending on whether a variable is intended to be signed or unsigned. Notice that I said "intended" - the CPU doesn't really know whether your data is meant to be signed or unsigned. This means that the quantity <tt>0xFFFFFFFF</tt> can represent either negative 1 or 4,294,967,295. But which one is it? Most high-level languages lock you into picking one, but at a hardware level it can be whatever you want it to be at any particular moment. (Kind of like the Ace in Blackjack.)
==Two's Complement==
|