unmanaged resource
-
Hello everyone, I think unmanaged resource means the resources (e.g. memory and file handler) which is used directly (new, FILE*) other than using a wrapper class (Resource Acquisition Is Initialization) or auto_ptr to wrap it. Is my understanding correct? Here is a sample about what is unmanaged resource. -------------------- http://www.gotw.ca/gotw/066.htm Moral #3: Always perform unmanaged resource acquisition in the constructor body, never in initializer lists. In other words, either use "resource acquisition is initialization" (thereby avoiding unmanaged resources entirely) or else perform the resource acquisition in the constructor body. -------------------- thanks in advance, George
-
Hello everyone, I think unmanaged resource means the resources (e.g. memory and file handler) which is used directly (new, FILE*) other than using a wrapper class (Resource Acquisition Is Initialization) or auto_ptr to wrap it. Is my understanding correct? Here is a sample about what is unmanaged resource. -------------------- http://www.gotw.ca/gotw/066.htm Moral #3: Always perform unmanaged resource acquisition in the constructor body, never in initializer lists. In other words, either use "resource acquisition is initialization" (thereby avoiding unmanaged resources entirely) or else perform the resource acquisition in the constructor body. -------------------- thanks in advance, George
Yes, I think that's pretty much the idea. Basically, in this context, 'unmanaged' means anything that is not destroyed/deallocated/uninitialized automatically. In Microsoft parlançe, though, 'unmanaged' means native code, as opposed to native code. (At least that's how I understood it.)
Florin Crisan
-
Hello everyone, I think unmanaged resource means the resources (e.g. memory and file handler) which is used directly (new, FILE*) other than using a wrapper class (Resource Acquisition Is Initialization) or auto_ptr to wrap it. Is my understanding correct? Here is a sample about what is unmanaged resource. -------------------- http://www.gotw.ca/gotw/066.htm Moral #3: Always perform unmanaged resource acquisition in the constructor body, never in initializer lists. In other words, either use "resource acquisition is initialization" (thereby avoiding unmanaged resources entirely) or else perform the resource acquisition in the constructor body. -------------------- thanks in advance, George
George_George wrote:
(thereby avoiding unmanaged resources entirely)
That is an unfortunate use of the word "unmanaged". RAII is about managing resources. This is the first person I have ever seen use the word "unmanaged" in reference to "managing resources". The author seems to be using "unmanaged" to reference code that does not implement RAII. It seems to me that the usage is incorrect because you are always managing a resource even if you do not use an RAII approach. IMHO the word has been used improperly. [Modification] Ummm ok. The author is Herb Sutter so I think he can say whatever he likes. "unmanaged" is fine by me. :-\
modified on Wednesday, January 02, 2008 3:07:20 PM