Over a million developers have joined DZone.

C# vs. C++: Compare and Transition


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.



The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}