I have recently inherited a project from someone that opted to do it in C++/.NET It is a relatively simple GUI application, which interfaces with some more complex code. I must say that dealing with managed code in C++ is annoying. Mixing GC and non GC pointers is confusing as all get out. I have been relying primarily on the compiler to yell at me when I try to delete something that is managed. I find it irritating that managed object functions can’t be const. This breaks one of my personal programming style guidelines. Another annoyance has been the Properties for some of the .NET provided objects. Take Point for example. It has get_X() and get_Y() but neither are declared const. This means that a function:
void DoSomethingWithAPoint(const Point &p) …
Has to make a copy of p to actually get at the members. I suppose I could remove the const, and make it :
void DoSomethingWithAPoint(Point &p) …
But in my mind, that implies that the function is going to modify the Point. So, I have to really write it as:
void DoSomethingWithAPoint(Point p)
which implies the copy. Most of the time, I don’t need the “expense” of the copy, as the operations are pretty darn simple.
I think the answer in the future is for us to better segment the code and provide a REALLY strict line between managed and unmanaged C++ code.
If I had my druthers, we wouldn’t be doing this in .NET — I have some comfort in the notion that this part of the project will be short lived.
I must say though, the difference between Linux – C++/emacs/gcc development and WinXP – Managed C++, Visual Studio development is quite large. I’m having to switch between them all day long. Hopefully I can reschedule these projects so I can do one and then the other. I’m not terribly efficient working as I am right now.

Recent Comments