Monday, September 12, 2011

C#, almost replacing C++

Here is an article with information I was just looking for in my blog:
http://www.codeproject.com/KB/cs/genericnumerics.aspx

I guess I never blogged anything on this, because someone else wrote a good article first. This is one of the most frustrating things about C#, and now I will be able to find it next time.

If C# had generics that supported primitives in a way that makes sense, I would use C# for 90% of the code I write in C++. C# has a lot more useful stuff built in, I usually can accomplish the same thing with less code, and for almost anything, the memory manager is better. Yet well after 1 decade, they can't fix problems with the simplest arithmetic, so I am stuck in C++ land for anything that does anything complicated with numbers. And no, Java's generics are not better.

While I am ranting, multidimensional array access (especially return and passing arrays as a parameter) stinks. The C# way makes sense, but I can understand C++ not wanting all that overhead. Still, by now, you'd think they'd have a way of making this easy to write and fast for performance - not they I have any idea how to do that.