Hacker News new | ask | show | jobs
by Gigachad 1278 days ago
For some reason most stuff still defaults to i32 and a lot of people use them for new code. At this point I'd not be against linters warning against using 32 bit ints unless you have a good reason.
3 comments

My alma maters vending machines used an unsigned integer for understanding school debt card balance. However the school debt card used a signed integer to allow for small negative balances.

Well students uncovered the flaw and had their cards be at negative 1 dollar, which the vending machine read as a very large balance.

They're still a good choice for most perf critical code due to the reduced memory use.
What I don't get is why you'd want a signed int for an id.