Microsoft Developer Tools Roadmap 2004-2005: "C++/CLI also streamlines the manner in which managed data types are defined and consumed. The new standard introduces keywords that are more intuitive to C++ developers than the underbar-underbar keywords of current Managed Extensions. In C++/CLI, the ref keyword is used in a manner similar to the Managed Extensions __gc keyword to define a garbage-collected class:
ref class MyRefClass { /* … */ };
In addition, C++/CLI introduces a new category of type, the handle, which is used to signify the use of automatic garbage collection. Handles borrow the syntax of pointers, but use the carat (^) in place of the asterisk (*). The keyword gcnew is used to create these garbage collected objects, and returns a handle:
MyRefClass ^ c = gcnew MyRefClass();
With C++/CLI, developers will also be able to incorporate traditional C++-style deterministic finalization for handle types. This means that a reference type may be optionally instantiated as an object using normal C++ stack-allocation syntax. In doing so, the object will automatically have its destructor called when it falls out of scope. This feature enables a style of programming not available in other languages targeting the CLR."
Wednesday, October 29, 2003
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment