4 ms·
If you call mmap/VirtualAlloc/open/fopen in your constructor and later it throws, you will have a resource leak, because the destructor won’t clean it up.
by GrumpySloth 3y ago
If you call mmap/VirtualAlloc/open/fopen in your constructor and later it throws, you will have a resource leak, because the destructor won’t clean it up.
- mgaunard 3y agoIf you don't know how to write exception-safe code -- for which RAII is the most common idiom -- then you have exception safety issues. I don't see how that relates to the thread, other than to say exceptions in constructors are quite fundamental.