3 ms·
OK, thanks for the clarification. C++ also has this issue, because vector<> and so forth can raise std::bad_alloc. So AFAIK basically nobody who writes kernel
by chubot 8y ago
OK, thanks for the clarification. C++ also has this issue, because vector<> and so forth can raise std::bad_alloc. So AFAIK basically nobody who writes kernels in C++ uses STL.
Although on second thought, I guess you can handle it because it's an exception rather than a panic. But exceptions have other downsides so people don't use them in that domain.
- steveklabnik 8y agoNo problem. And yeah, it’s effectively the same. You can catch panics if you really need to, but it’s certainly not idiomatic generally. (And most OS-level code makes them aborts which cannot be caught.) This is a situation where it would be... fine. Not as nice as making the api fallible from the start.