What is managed code?

4

In a conversation with a co-worker about which language was used to develop Windows, he said that many parts should still be developed in C and C ++, since it was necessary to run unmanaged code. Other parts are already developed in C #. From there the question arose: what differentiates managed code from unmanaged and what is the application of each of them?

    
asked by anonymous 23.03.2017 / 04:37

1 answer

5

Windows is essentially developed with C, and most of the newer APIs are in C ++, with some compatibility with C. There is nothing important in Windows that uses .NET, it can be completely uninstalled. It's a myth that Microsoft is developing almost everything in C #. She does what feels right to her.

.NET is a platform that Microsoft has created to give you more security and flexibility in software development. I even intended to move to .NET, but it proved to be impractical. .NET is an implementation of various technologies, including the runtime called the Common Language Runtime a>. This runtime manages execution, execute permissions, and memory used. As much as the programmer wants to make things unsafe and / or problematic in their code, the platform does not leave, everything has to go through it and it manages what it is possible to do, so it is called managed code.

The most obvious form of management is the garbage collector that controls all allocations and memory releases, it takes management of memory.

It is possible to have implementations that only contain GC management. So, strictly, the managed code is one that uses the GC to take care of memory, while the unmanaged one lets you do what you want with memory.

Some people may think of other things, but you still have managed code even if you're a native, even if you do not have a JITter , a CAS , and other technologies.

Related: What is marshalling and how does it work? .

    
23.03.2017 / 04:52