Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
bringbart
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
bringbart
1y ago
unsigned is easier: 'if(index >= max)' and has fewer edge cases because you don't need to worry about undefined behavior when computing index.
2.
▲
by
bringbart
1y ago
>while unsigned wraparound leads to bugs which are basically impossible to find. What? unsigned sizes are way easier to check, you just need one invariant: if(x < capacity) // good to go Always works, regardless how x is cal