Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
I have come across this terminology a number of times - signed and unsigned integers. I have looked the concepts up on Google, but the explanations I have read made very little sense. Anybody have an idiot's answer?
Unsigned is without a + or - sign. Integers are signed by default. They can contain positive and negative values. That's why if you use INT UNSIGNED for a db field in MySQL, it can hold twice the maximum value. The range stays the same though.
Well, you asked for "idiot's answer" so here it is:
<idiot's answer>Unsigned integers can hold a larger value than the equivalent signed</idiot's answer>
just remember to choose the correct type, you don't want over flow. that means taht you've reached the max number and you go back to zero. that my friend would blow some serious balls
well when you are starting out and you get an overflow error (C/C++ -> Games) you don't know what the hell you did or why it's screwing up until someone tells you what is wrong. it's not fun. not fun at all.
jamiel wrote:For interests sake, the signed range of a normal INT in MySQL is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295.
Indeed the answer to this question is a very practical one -- especially in the early days of computers. Maintaining a numbers sign required an additional bit, effectively reducing by half the maximum value that could be stored. That can make a large difference in the range, so chips and programming languages allowed the use of integers without a sign bit when the programmer need a higher max but no negative numbers.