Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Managed and Unmanaged Code

Status
Not open for further replies.

sweep123

Technical User
May 1, 2003
185
GB
Can anyone provide a good and simple definition of managed/unmanaged code, in particular to Microsoft Visual Studion .Net and MFC applications.

The more I read the less I understand!
 
I don't know if this qualifies as "good", but here's how I would define it:

Managed Code: similar to Java, it is code that is compiled to run in a more restricted but protected run-time environment called the "CLR". It is safer and more portable because the CLR handles low-level details and platform differences for you. You don't have direct control of things like pointers, and other common programming mistakes are easier to spot and correct, sometimes automatically by the language or the CLR.

Unmanaged Code: the old way of making code where it is compiled all the way to native instructions, and runs independently of the CLR. You have full control over things like pointers.
 
You can use C++ .NET objects with __gc declarations if you create a C++ .NET project. I've seen what it does not look like a veritable C++. For example when I delete some pointer allocated with new, is executed destructor as usualy in C++, but object is not deleted. For example if there are many pointers to this object, you can use them after the delete operation.

Ion Filipski
1c.bmp
 
OK thanks, just one additional question, what does CLR stand for?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top