3 ms·
Note, I get warning: this expression will panic at run-time when compiling it, but that's besides the point. Panicking is exactly what makes it memory safe
by C4K3 10y ago
Note, I get
warning: this expression will panic at run-time
when compiling it, but that's besides the point.
Panicking is exactly what makes it memory safe, it doesn't access any out of bounds memory. Write an equivalent program in C, and nothing will error, but instead will output something like 140733019311920. Which of those is preferable?
- ue_ 10y agoWhat code did you use to make it print that error? I only get that error if I access the array directly with a subscript (i.e using the constant 4 instead of 4 stored in the variable 'a').
- steveklabnik 10y agoYes, the warning is very limited at the moment.