Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In C++ you can also make the FD-equivalent of std::unique_ptr, like Android does with unique_fd: https://cs.android.com/android/platform/superproject/main/+/...

It doesn't guarantee the issue never happens, like Rust would, but it does make it dramatically less likely to occur.

Also I think in general people vastly under-appreciate how severe an issue EBADF actually is. Outside of extremely specific, single-thread-only scenarios, that error is essentially the kernel telling you that heap corruption occurred, but almost nobody treats it with that level of severity



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: