5 ms·
There's a similar rule of thumb in .Net with respect to managing native resources. Inlining the logic that handles the lifetime is much more bug prone than enca
by Strilanc 14y ago
There's a similar rule of thumb in .Net with respect to managing native resources. Inlining the logic that handles the lifetime is much more bug prone than encapsulating that logic into a wrapper class (e.g. SafeHandle http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.safehandle.aspx http://msdn.microsoft.com/en-us/library/system.runtime.inter... does this).
- Flow 14y agoI guess I'm lucky enough to never have seen that class in code I've seen. :) That seems like typical Microsoft object-orientation. It's not really much of encapsulation. Reminds me of MFC :-/
- pjmlp 14y agoActually Microsoft started by developing a C++ library with lots of OO in the design. However not everything went as they expected and people were also demanding something more light over Win16 and MFC was born. http://computer-programming-forum.com/82-mfc/d13ea80282846f9f.htm http://computer-programming-forum.com/82-mfc/d13ea80282846f9...