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

RAII used to be incompatible with exceptions (I'm not sure whether anything changed for the better in C++17). The reason is that you can't throw exceptions from destructors, and e.g., on Linux, destruction of the file object (wrapping a file descriptor) can result in an error because close() may well return -1 setting errno to EIO. See `man 2 close` for details.


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

Search: