33 ms·
I've just checked and it appears that c++'s std::vector::resize may throw std::bad_alloc when malloc fails, but rust's Vec::resize's interface doesn't leave any
by yakubin 7y ago
I've just checked and it appears that c++'s std::vector::resize may throw std::bad_alloc when malloc fails, but rust's Vec::resize's interface doesn't leave any room to report any errors, so I guess that it will panic...? That's sad.
- steveklabnik 7y agoThe standard library assumes infallible allocation, yeah. We have plans to add fallible stuff eventually, but we’re still working on our allocator APIs.
- hurrrrrrrr 7y agoRust in general will panic on memory allocation failure. There was some discussion about oom handling a while back but I don't know the current state.
- Animats 7y agoNow you regret not putting in exceptions.