|
|
|
|
|
by cube00
19 days ago
|
|
> That's not really a memory safety bug, due to the fact that it panics rather than doing something unsafe. The ? operator can be nicer to read then all those .unwraps() as an alternative and doesn't panic. I guess the concern with panics is you're not forced to think about how you want to handle them like you do when you get a `Result` or `Option` returned. As a result it could be used as a DDOS against your app if it's network accessible. |
|
I would go so far as to say that an out-of-bounds index is always a logic error (to be handled by panicking), not an input error (to be handled with Result). And if the out-of-bounds access was caused by invalid input, then logic error consists of not checking the input before indexing.