Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you mentally handle going from writing managed to non-managed code?

Tags:

c++

c#

~80% of the code I write is in C#. The other ~20% is in C++. Whenever I have to switch from C# to C++, it takes me quite a while to mentally "shift gears" to thinking in C++. I make simple mistakes using pointers and memory allocation that I would not have made when I was in university. After the adjustment period, I am fine and writing in native code comes naturally.

Is this normal? Does anyone else experience something similar and if so, what do you do to cut down on the time this wastes?

Edit: I'm not saying that I cannot work with memory allocation and pointers. I comfortably use them often in my C++ code. Just not immediately after working in C# for long periods of time.

like image 483
Glenn Sandoval Avatar asked Apr 29 '10 23:04

Glenn Sandoval


People also ask

What are the differences between managed code and unmanaged code?

Managed code is the one that is executed by the CLR of the . NET framework while unmanaged or unsafe code is executed by the operating system. The managed code provides security to the code while undamaged code creates security threats.

Which is a security advantage of managed code over unmanaged code?

What are the advantages of using Managed Code? It improves the security of the application like when you use runtime environment, it automatically checks the memory buffers to guard against buffer overflow. It implement the garbage collection automatically. It also provides runtime type checking/dynamic type checking.

What does unmanaged code mean?

Code that executes under the control of the runtime is called managed code. Conversely, code that runs outside the runtime is called unmanaged code. COM components, ActiveX interfaces, and Windows API functions are examples of unmanaged code.

How is unmanaged code executed?

Unmanaged code is executed with help of wrapper classes. Wrapper classes are of two types: CCW (COM Callable Wrapper) and RCW (Runtime Callable Wrapper). Wrapper is used to cover difference with the help of CCW and RCW.


1 Answers

I have the same problem. I use completely different color schemes for Visual Studio (dark-on-light for C++; light-on-dark for C# and VB).

Seems to help my brain ease the switch.

like image 142
BlueRaja - Danny Pflughoeft Avatar answered Sep 18 '22 00:09

BlueRaja - Danny Pflughoeft