Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
0 points
swagonomixxx
5y ago
0 comments
Share
Assuming a unsigned byte, that range of values is between 0 and 255 inclusive, so `len(arr) <= 255` is correct.
undefined | Better HN
0 comments
default
newest
oldest
wtetzner
5y 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.
j
/
k
navigate · click thread line to collapse