469,902 Members | 1,813 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

deterministic destruction support for managed types in VC++ 2005beta 1

Do ref classes indeed support instantiation on the stack? Similarly, can
native classes be instantiated on gc heap?

When you try to have a ref class instance on the stack, you'll get:

R : cannot use this type here without a top-level '^'.

When you try to instantiate a native class using gcnew using Visual
Studio 2005 Beta 1, you'll get:

error C2726: 'gcnew' may only be used to create an object with managed type.

I was going through the C++/CLI Language Specification Working Draft
1.5, Jun, 2004, and nowhere I could find a clause that would make me
believe that managed types are allowed to go on the stack or native heap.

I've read articles, such as this one
http://www.codeguru.com/Csharp/.NET/...cle.php/c7405/

that makes all sorts of claims regarding support for deterministic
destruction for managed types. Where is it mentioned in the C++/CLI draft?

Regards,
Slawomir Lisznianski [ www.rhapsodia.org ]

Nov 17 '05 #1
2 1151
Slawomir Lisznianski wrote:
Do ref classes indeed support instantiation on the stack? Similarly,
can
native classes be instantiated on gc heap?

When you try to have a ref class instance on the stack, you'll get:

R : cannot use this type here without a top-level '^'.

When you try to instantiate a native class using gcnew using Visual
Studio 2005 Beta 1, you'll get:

error C2726: 'gcnew' may only be used to create an object with
managed type.

I was going through the C++/CLI Language Specification Working Draft
1.5, Jun, 2004, and nowhere I could find a clause that would make me
believe that managed types are allowed to go on the stack or native
heap.

I've read articles, such as this one
http://www.codeguru.com/Csharp/.NET/...cle.php/c7405/
that makes all sorts of claims regarding support for deterministic
destruction for managed types. Where is it mentioned in the C++/CLI
draft?


VC++ 2005 will support GC types on the stack, but that support is not in
Beta-1. I don't know about native types on the GC heap. I believe that's
in the long-term plan (complete unification of the GC/native type system),
but I'm not sure if it's in the 2005 compiler or not.

-cd
Nov 17 '05 #2
Carl Daniel [VC++ MVP] wrote:
VC++ 2005 will support GC types on the stack, but that support is not in
Beta-1. I don't know about native types on the GC heap. I believe that's
in the long-term plan (complete unification of the GC/native type system),
but I'm not sure if it's in the 2005 compiler or not.


Unfortunately, creating native classes with gcnew did not make it into the
Visual C++ 2005 release. It's one of the top features for the next major
release of Visual C++.

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Bredal Jensen | last post: by
10 posts views Thread by Gary Hughes | last post: by
4 posts views Thread by William F. Kinsley | last post: by
11 posts views Thread by Peter Oliphant | last post: by
8 posts views Thread by JAL | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.