Behind the Brain

Managed, unmanaged, half-managed... it's just code!?

As I mentioned some time ago I am porting a C++ library to C# (no I won't tell you which one, this will be a surprise) and I tell you one thing: doing so is no fun! No pointers, no multiple inheritance, no default parameters, generics are nothing compared to C++ templates, the list goes on and on...

Don't get me wrong on this. I really love C#. I feel more comfortable coding in C# than I ever felt coding in C++. And C++ is my first big love since I learned programming in C++. However except the 'C' in their name these two languages don't have very much in common. For example - as you might know - C++ handles arrays and pointers almost the same way. So in C++ you can 'add' a number to a pointer and the pointer will move forward. Just don't try this on a C# array. So this means create a new variable that holds the current index and move that index along... great. And then of course void pointers... if you handle them right they can be very handy...

If you ever have to make the choice if you port some legacy application from C++ to C# or to rewrite them: REWRITE THEM! There are too many differences between the managed and the unmanaged approach. If I hadn't already invested that much time into the port I guess I would have written the whole library from scratch, but no I already have 40k lines of code and I won't throw them away. By the way these 40k lines are about one fifths of the library but thats enough information. If you figure out what library I'm porting feel free to help me :D

So far Happy Coding ;)

Aug 10th 2010, 17:20 by Sylence.

Back to top