Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×

Comment: Re:Confused (Score 1) 160

by Shennan (#43670287) Attached to: Integer Overflow Bug Leads To <em>Diablo III</em> Gold Duping

In general, it's a good idea to used signed ints whenever possible.

Here are the only 2 reasons I see for unsigned ints:
- matching hardware or wire spec
- You need the extra range afforded, and don't need negative numbers.

And the reasons for using signed integers otherwise:
- It prevents other overflow and comparison problems. Ie, fixes other dumb coding issues like "if (my_gold - your_gold > 0)" becomes a bug when the gold types are unsigned.

I never cheated an honest man, only rascals. They wanted something for nothing. I gave them nothing for something. -- Joseph "Yellow Kid" Weil

Working...