Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between managed C++ and C++ [closed]

The second question is: When do I use what of these two?

like image 929
nutario Avatar asked Sep 22 '08 10:09

nutario


People also ask

What is difference between managed and unmanaged code?

Managed Code is converted to IL, Intermiddiate Language also termed as CIL of MSIL. Unmanaged Code is converted to native language code. Programmer has no low level access using Managed Code. Programmer can write low level access code using unmanaged code.

What is the difference between managed and native code?

Native code is written in the "native" machine language of the computer that it is running on and is executed directly by the processor. Managed code is written in a special language that requires another program to run (i.e. manage) it.

Is C++ managed or unmanaged?

The C++ compiler actually uses two heaps, a managed an unmanaged one, and uses operator overloading on new to decide where to allocate memory when you create an instance with new.

What is managed or unmanaged code in C#?

Managed code uses CLR which in turns looks after your applications by managing memory, handling security, allowing cross - language debugging, and so on. The code, which is developed outside . NET, Framework is known as unmanaged code.


2 Answers

When not specified, C++ is unmanaged C++, compiled to machine code. In unmanaged C++ you must manage memory allocation manually.

Managed C++ is a language invented by Microsoft, that compiles to bytecode run by the .NET Framework. It uses mostly the same syntax as C++ (hence the name) but is compiled in the same way as C# or VB.NET; basically only the syntax changes, e.g. using '->' to point to a member of an object (instead of '.' in C#), using '::' for namespaces, etc.

Managed C++ was made to ease transition from classic C++ to the .NET Framework. It is not intended to be used to start new projects (C# is preferred).

like image 91
Laurent Avatar answered Sep 22 '22 01:09

Laurent


"Managed C++" refers to a language that was included in Visual Studio.NET/Visual Studio.NET 2003. It has since been deprecated, with the latest .NET C++ being C++/CLI.

like image 31
TraumaPony Avatar answered Sep 22 '22 01:09

TraumaPony