So it’s Ludum Dare 24 weekend (Aug 24th), and I’m finally catching up on some work I had to put off as I … ahem … attended to my duties. Now that the event is going strong, it’s reading time!

The main thing I need to do is some Windows 8 research. I installed the Windows 8 RTM (release) Trial on a new machine earlier this week, as well as the Visual Studio 2012 Express. I generated a basic Direct 3D app to discover, “oh crap, there’s some C++11 stuff going on here now” (EDIT: Yes it was some C++11, but specifically WinRT and C++/CX [video]). So I decided to look more closely at what C++11 features can be practically used in a cross platform sense in apps written today.

References: C++0x on Apache Wiki, C++11 FAQ, MSDN Blog C++11 Support (2), C++ Rocks (2)

For a good reference of new things added in C++11, check out Wikipedia.

The 3 Compilers: GCC, Clang, and MSVC

First a quick summary of the data found here.

Clang has extremely quickly matured in to the most C++11 compliant compiler available. As of May of this year, Clang 3.1 was released, and supports most C++11 features. If I was to place a bet, my bet would be that Clang reaches 100% compliance before the other two.

GCC 4.7 is a very complaint C++11 compiler. GCC 4.4 was one of the first GCC versions to add a significant number of C++11 features. It’s been around since April 2009, with the latest version 4.4.7 released in March of this year. Because of its age, it’s fairly common now, and at the point where we can expect nearly all modern devices to use at least this.

Visual Studio 2012 was released a week ago (Mid August), though it’s been in public beta for a while longer. With the impending Windows 8 Launch in October, this one will be getting some heavy usage over the next few years. Visual Studio 2010 added several C++11 features, but the list has grown since.

Target Platforms

A list of current targets and platforms that have C++ compilers, and what they are based on.

Updated: Nov 4th, 2012

  • Android – NDK 8b (ARM, x86, MIPS) – GCC 4.6
  • iOS 5 – Xcode 4.4.1 (ARM) – Clang 3.1 ??
  • Mac OS X 10.8 – Xcode 4.4.1 (x86, x64) – Clang 3.1 ??
  • BlackBerry 10 (and PlayBook) – Native SDK 2.1 (ARM) – GCC 4.4.2 *
  • Marmalade 6 – iOS+Android+BB10 (ARM, x86, MIPS) – GCC 4.4.1 *
  • ChromeNative Client/Pepper 21 (x86, x64) – GCC 4.4.3 *
  • HTML5Emscripten (JS) – Clang 3.1
  • Ubuntu 12.04 LTS – (x86, x64, ARM) – GCC 4.6.3
  • Ubuntu 12.10 – (x86, x64, ARM) – GCC 4.7.2
  • WindowsMinGW (x86) – GCC 4.7
  • Windows XP, Vista, 7 – Visual Studio 2010 Express (x86, x64) – VC10
  • Windows 7 and 8 – Visual Studio 2012 Pro (x86, x64, ARM) – VC11
  • Windows 8 – Visual Studio 2012 Express (x86, x64, ARM) – VC11
  • Windows Phone 8 – Visual Studio 2012 Express (ARM) – VC11
  • FreeBSD 9GCC 4.2.1 *
  • Adobe FlashFlasccGCC 4.2.1 *

(?? – Unconfirmed, * – Legacy GCC)

All that said, if what you care about are Open and App platforms, (aside from FreeBSD and Flascc) you can target every platform today with some C++11 features!

What I can I use?

The safest feature choices seem to be a cross section of things that are available in GCC 4.4 and VC10/VC11. Be sure to enable C++11 or C++0x mode if you’re using GCC or Clang (Google it yourself).

Features Available (GCC 4.4+, Clang, VC10+)

  • Atomic Operations – Spec (VC11)
  • auto – Spec 0.9, 1.0, MSDN
  • decltype – Spec 1.0 (Final is 1.1), MSDN
  • extern template – Spec
  • New function declaration syntax for deduced return types – Spec
  • Right Angle Brackets – Spec
  • R-Value References – Spec 1.0 (Final is 4.0, so it may be unwise)
  • static_assert – Spec
  • Strongly-typed enums – Spec (VC11)
  • Thread-Local Storage – Spec (partial support with __thread keyword)
  • Built-in Type Traits – Spec

Data and Links above are sourced from here and here.

But wait, I don’t need those weird ones

If Marmalade, Chrome’s Native Client, BlackBerry 10, FreeBSD and Flascc don’t matter to you, then you’re in C++11 town. You can use all features supported by Visual Studio 2012 except:

  • Extended friend declarations
  • override and final

You can find the complete Visual Studio 2012 supported list here.


Aside from FreeBSD and Flascc, amazingly, it’s actually possible today to use some C++11 features in your code, and that code will work in compilers from the other 2 vendors. And depending on your needs, you can today use almost everything Visual Studio 2012 supports. Wider C++11 platform support is just a GCC upgrade away… and then we wait for Microsoft’s next compiler upgrade cycle.