Re:Rust RAII is better than the Haskell bracket pattern
by nineteen999 on Friday October 12, 2018 @05:28PM
(#18204847)
Point being, the same is not true for virtual memory.
You could leave the memory deallocation out of the destructors, and it is all going to be returned to the OS instantly on _exit().
yes, the class has to be written only once - and I have personnally never had to write it except in that one group project in school, since I use libraries that handle it - e.g. boost.asio or Qt Network.
If you are in C, even if you use an abstraction layer, you have to remember to call a _free / _destroy-like function every time you write some code that uses sockets.