Y
Hacker News
new
|
ask
|
show
|
jobs
by
swagonomixxx
2164 days ago
Assuming a unsigned byte, that range of values is between 0 and 255 inclusive, so `len(arr) <= 255` is correct.
1 comments
wtetzner
2164 days ago
But the loop goes up to 255. So if len(arr) == 10, then assert!(len(arr) <= 255) woulds succeed, but you'd get an out-of-bounds access if you tried to access arr at 11.
link