.NET Zone is brought to you in partnership with:

John Esposito edits Refcardz at DZone, while writing a dissertation on ancient Greek philosophy and raising two cats. In a previous life he was a database developer and network administrator. John is a DZone Zone Leader and has posted 320 posts at DZone. You can read more from them at their website. View Full User Profile

C# vs. C++: Compare and Transition

  • submit to reddit

While browing Jerry Nixon's latest blogposts I stumbled across a link to an awesome guide for anyone transitioning from C# to C++, written by Michael McLaughlin and posted on his blog and as a pdf.

Michael describes his guide like this:

This is a somewhat short guide to the important things to know if you are a C# programmer and find yourself needing or wanting to work in C++, for example to create Metro style games for Windows 8 using C++ and DirectX.

It's very organized, starting with more abstract things like namespaces, fundamental types, objects (including inheritance and union), functions, and moves on to more concrete issues (string handling, list types, storage duration, lambda expressions). All in just 52 pages, so think about it if you're a C# coder and want to move a little closer to the metal.

The guide wasn't actually super-useful to me, though, because I learned a bit of C++ rather too many years ago, when C# barely existed -- so my quick browse left me wondering more about the other direction: C# for a C++-er. And Jesse Liberty on MSDN does have an old article explaining just this, quite concisely, with due emphasis on the difference between an unmanaged (C++) and managed (C#) environment.

But I like feature-lists, so I found a neat little checklist from 2007, on the no-longer-active-but-once-thriving Thinking Parallel blog, with TONS of useful discussion in the comments afterwards. If you're a C#-er transitioning, to C++, you may feel a little disappointed at what C# does, and C++ doesn't do: garbage collection, for instance, or built-in threading support, or Unicode string encoding, or treating arrays as objects. But you might feel exhilirated as well (destructors!).

Most importantly, perhaps: the discussion on this post is still active (latest post: Feb1, 2012), and the checklist seems to have become a significant space for C#-to-C++-and-vice-versa discussion. So check out the checklist if you're thinking of moving from one to the other -- or the discussion, if you have questions, or perhaps already have something to contribute.



Ajya Chang replied on Fri, 2012/02/24 - 4:50am



Thanks for the comparision of both the great languages. I think both of htme have their own advantages if used properly. But I will prefer to learn C++ first then go to C# as it will ease out. Since oops concepts can be understood well with C++. Anyways thats an indivudual's choice. Thanks once again  for the information.


John Esposito replied on Fri, 2012/02/24 - 12:40pm

Hi Ajya, thanks for the comment! I agree with you -- though my impression is that plenty of developers learned C# first because .NET offers so much leverage.

But this raises an interesting question: do different developers just have different learning styles? that is, do some like starting hard and going easy, and others like easing in before tackling a less hand-holding language like C++? Like Codeacademy vs. Programming from the Ground Up...

Kookee Gacho replied on Thu, 2012/06/14 - 5:33am

Due to technical limitations of display and the fact that the sharp symbol is not present on the standard keyboard, the number sign was chosen to represent the sharp symbol in the written name of the programming language.-Arthur van der Vant

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.