Get the latest tech news
Modern C++ – RAII
— RAII Modern C++ embraces the features from C++11 which lay the foundation for a new generation of C++. It introduced move semantics and embraced RAII in the standard library ( unique_ptr, shared_ptr, lock_guard).
We'll create a safe wrapper around a UNIX file descriptor keeping in mind that the same concept can be applied to any other resource. That's a problem — file descriptors aren't simple numbers that can be copied since they're a handle to a resource the kernel holds for us. In GCC and Clang, the warning is hidden behind the-Wdeprecated-copy-dtor flag which is disabled by default and almost never enabled(not part of-Wall,-Wextra or-Wpedantic).
Or read this on Hacker News