New syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to C++ so I may be missing something. But doesn't using the new
syntax ^ instead of * for pointers and 'gcnew' instead of 'new' for example
make the code very non-portable to unmanaged C++, if the need ever arises?

Rasika.

PS. Is it possible to use managed assemblies from unmanaged code?
 
Rasika WIJAYARATNE said:
I am new to C++ so I may be missing something. But doesn't using the new
syntax ^ instead of * for pointers and 'gcnew' instead of 'new' for
example
make the code very non-portable to unmanaged C++, if the need ever arises?

Yes. But that is beside the point. Standard C++ does not provide for
automatic garbage collection. The new syntax is used for manipulating
grabage-collected objects on the managed heap.

Regards,
Will
 
Rasika said:
I am new to C++ so I may be missing something. But doesn't using the
new syntax ^ instead of * for pointers and 'gcnew' instead of 'new'
for example make the code very non-portable to unmanaged C++, if the
need ever arises?
Yes.


Rasika.

PS. Is it possible to use managed assemblies from unmanaged code?

Yes. If the main program is unmanaged, you can use the .NET hosting APIs to
host the CLR and managed code in your unmanaged app. If the main program
can be managed, then VC++ can handle all the interop for you and you can mix
and match managed/unmanaged code pretty much as you see fit.

-cd
 
and match managed/unmanaged code pretty much as you see fit.

Can you mix managed and unmanaged code within the same class using C++/CLI?
 
Thanks for the information.

Carl Daniel said:
Yes. If the main program is unmanaged, you can use the .NET hosting APIs to
host the CLR and managed code in your unmanaged app. If the main program
can be managed, then VC++ can handle all the interop for you and you can mix
and match managed/unmanaged code pretty much as you see fit.

-cd
 
Back
Top