Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

New syntax

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rasika WIJAYARATNE - 06 Jul 2005 00:44 GMT
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?
William DePalo [MVP VC++] - 06 Jul 2005 01:09 GMT
>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
Carl Daniel [VC++ MVP] - 06 Jul 2005 01:21 GMT
> 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
Rasika WIJAYARATNE - 06 Jul 2005 02:59 GMT
> 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?
William DePalo [MVP VC++] - 06 Jul 2005 03:44 GMT
>> 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?

Yes, you can.

Regards,
Will
Rasika WIJAYARATNE - 06 Jul 2005 04:40 GMT
Thank you for your help.

> >> and match managed/unmanaged code pretty much as you see fit.
> >
[quoted text clipped - 5 lines]
> Regards,
> Will
Rasika WIJAYARATNE - 06 Jul 2005 04:41 GMT
Thanks for the information.

> > 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'
[quoted text clipped - 13 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.