Jump to content
  • Advertisement
Sign in to follow this  
guyaton

managed vs unmanaged c++

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What's the difference between managed and unmanaged c++. I've heard it mentioned alot but having been programming for a couple of years I'm not sure which one I am currently using. Currently I used MS VS.NET (2002). Is that managed or unmanaged? Which one is better? What are the basic benefits of each? Thanks in advance, ~guyaton

Share this post


Link to post
Share on other sites
Advertisement
Unmanaged code , compiles to the classic "pure" exe , like in
previous Visual c++ compilers.It is Native .exe that works just as
if u would made it with intel's compiler or what have you.

Managed code, uses the .net bytecode.
It therefore needs the .net runtime to work.

Benefits are (visual studio '02/03 , '05) :
In unmanaged code u work with a much more standard compliant
implemantation of the C++ standard, compared to VC++ 6.
Since it is Native , you reap the benefits of runtime speed.


In Managed code, u get all the benefits of the .net platform,
wich is in microsoft's vision, the future of the windows platform,
as Longhorn will have crucial technology like avalon/indigo extend
the .net codebase.

The Managed C++ version also gives u the option to use the Garbage
Collector, wich provides you with a facility to automate the freeing
of allocated memory.

Hope this helps :)

Share this post


Link to post
Share on other sites
Also MSVC++ .NET can produce either standard C++ exectuables or managed C++.

So saying that you're using VC.NET doesn't mean that you're using managed c++ or unmanaged C++.

Share this post


Link to post
Share on other sites
how do i switch between them? I'm assuming with unmanaged there's a higher potential for memory leaks? does managed attempt to fix this? how do i enable the optional garbage collector?

thanks again,

~guyaton

Share this post


Link to post
Share on other sites
Managed C++ has a somewhat different (well, additional) syntax than unmanaged C++. If you've been learning through books, school, or tutorials, I can almost guarantee that you've been learning unmanaged C++. To use the features of managed C++, you'll have to find some reference material or tutorials or something to help you learn to use the additional syntax that managed C++ provides. It isn't one of those things where you just turn it on or off. Programming in managed C++ takes a slightly different programming mindset than programming in unmanaged C++, and code doesn't typically translate from one to the other without at least a few changes here and there.

Note that you can mix managed and unmanaged code together in a single project, however, so that it becomes easier to slowly migrate a completely unmanaged project into a largely or completely managed project.

Share this post


Link to post
Share on other sites
I meant turning it off/on in the Visual Studio enviroment. If i'm writting unmanaged code, there's no need to have extra "stuff" in my exe...right?

Share this post


Link to post
Share on other sites
I am using managed C++ for my level editor, and my main engine is regular C++, using vs.net 2003.

I am using windows forms as well, and AFAICT, the managed C++ part of windows forms at least is a buggy mess. Sort of the red-headed stepchild of .net forms.

Now that I know the things to watch out for, I'm productive in it, but it was not easy.

I have not tried managed C++ in a non-windows forms environment, so I can't comment about it.

Share this post


Link to post
Share on other sites
Right, the current incarnation of Managed C++ is an ugly beast, and really should only be used if you have to use it. If you want to do .Net, use another language like C# or wait for the next incarnation of Managed C++ called C++/CLI which is supposed to actually integrate nicely with .Net.

Share this post


Link to post
Share on other sites
Quote:
Original post by intrest86
Right, the current incarnation of Managed C++ is an ugly beast, and really should only be used if you have to use it. If you want to do .Net, use another language like C#


Agreed.

Managed C++ should not even exist IMO. I've heard that benchmarks show managed C++ is slower than managed C#, and the biggest reason to use C++ over C# anyway is speed. C# is far easier to code and very easy to learn - I learned the entire language in literally a day. I don't know why Microsoft thought managed C++ would be a good thing, I see it as an oxymoron because it destroys the main purpose of using C++.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!