Friday, July 31, 2009

Managed and unmanaged with C++?

traditional C++ is only unmanaged code programming language, while microsoft visual C++ offers managed and unmanaged,


which one is better? managed or unmanaged and why? where to use each of them?


by the way, managed and unmanaged is about memory allocation and de-allocation management!

Managed and unmanaged with C++?
"managed" is about letting the computer do some stuff for you.


"unmanaged" is about trusting that a human being with brains can do those things better and more effectively.





Which is "better" depends on the person. Some people do know better than the computer (and prefer "managing" their own memory), and some, apparently don't (or think they don't), andn prefer that microsoft do it for them.


Ever seen these annoying windows popping up, and saying that such and such application tried to access such and such memory and was killed? These are coming from the programs, written by people of the latter kind
Reply:The managed code is a code which runs under the supervision of CLR which ships with .NET Framework.


The CLR provides many run-time features to ur code like thread management, more sophisticated memeory management(Undeterministic finalization) and so on..





What u can choose depends upon ur requirement...means what u want to do with ur code...if it more towards system level then I will suggest u to go for unmanaged.





Also, depends whether u want to port it to some other machine then, go for unmanaged code as it will save u from installing .NET Framework(as it is needed for managed code).
Reply:n0body has given you a good answer, just to explain a bit more.





With managed code from MS, you will have pverhead that will slow down your system. If speed is not all that crucial to you, then go for the managed code.





One thing n0body forgot to mention, with people thinking the computer can do a better job, that computer needed to be programmed by someone. The question really comes down to, do you trust a person a MS to be able to provide a good program, or would you rather build the program yourself, knowing what you have done.
Reply:according to me visual C++ is more better ...more diverse and yes managed programming helps you for not worrying about many issues and just concentrating on yr work


No comments:

Post a Comment