Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
swagonomixxx
5y ago
0 comments
Save
Share
Assuming a unsigned byte, that range of values is between 0 and 255 inclusive, so `len(arr) <= 255` is correct.
0 comments
1 comments · 1 top-level
top
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