This page will attempt to describe features of modern C++ standards (C++11, C++14, etc.) supported by the game. For information on building the game, see BuildInstructions.

Supported Compilers

0 A.D. is a cross platform game written primarily in C++ and JavaScript, and as such it has to support multiple compilers with different implemented features. Here are the currently supported compilers for the game:

  • GCC 4.8.1 or newer
  • Clang 3.4 or newer
  • Visual Studio 2015

The following tables summarize C++11 support for the above compilers. Features available (Y) in all supported compilers are marked green and believed safe to use. Features not available (N) in all supported compilers are marked red and generally should not be used in 0 A.D. In a few cases there is partial support (P), these rows are yellow.

Code examples are given for many features as the formal names can be unclear.

C++11 Core Language Features

Feature Example GCC 4.8.1 Clang 3.4 VS 2015 0 A.D. Support Notes
Emplacementemplace, emplace_back Y Y Y Y
Rvalue referencestype_t && Y Y Y Y
Rvalue references for *thisvoid RValueFunc() &&; Y Y N N N1821
Initialization of class objects by rvalues Y Y Y Y
Non-static data member initializersclass Foo{ public: int bar=7; }; Y Y Y Y
Variadic templatestemplate<typename T, typename... Args> Y Y Y Y
Extending variadic template template parameters Y Y Y Y
Initializer listsvector<int> v = { 1, 2, 3, 4, 5, 6 }; Y Y Y Y
Static assertionsstatic_assert(expression,message); Y Y Y Y
auto-typed variables for (auto p = v.begin(); p!=v.end(); ++p) Y Y Y Y
Multi-declarator autofor (auto p = v.begin(), e=v.end(); p!=e; ++p) Y Y Y Y
Removal of auto as a storage-class specifierauto int r; Y Y Y Y
New function declarator syntax Y Y Y Y
New wording for C++0x lambdas Y Y Y Y
Declared type of an expressiontypedef decltype(a[0]*b[0]) Tmp; Y Y Y Y
Incomplete return types Y Y Y Y
Right angle bracketslist<vector<string>> lvs; Y Y Y Y
Default template arguments for function templates Y Y Y Y
Solving the SFINAE problem for expressions Y Y P N
Template aliasestemplate<class T> using Vec = vector<T,My_alloc<T>>; Y Y Y Y
Extern templatesextern template class Foo<int>; Y Y Y Y
Null pointer constantchar* p = nullptr; Y Y Y Y
Strongly-typed enumsenum foo : int {}; Y Y Y Y
Forward declarations for enumsenum class Foo : char; Y Y Y Y
Generalized attributes[[attributes]] Y Y Y Y
Generalized constant expressionsconstexpr int a = b.x; Y Y P N Issues discovered in VS 2015
Alignment supportalignas(16) char[100]; Y Y Y Y
Delegating constructors Y Y Y Y
Inheriting constructors Y Y Y Y
Explicit conversion operatorsexplicit operator bool() Y Y Y Y
New character typeschar16_t / char32_t Y Y Y Y
Unicode string literalsu"string" Y Y Y Y
Raw string literals r"\string!\"; Y Y Y Y
Universal character name literals Y Y Y Y
User-defined literals / extensible literalsstd::string operator""s (const char* p, size_t n) Y Y Y Y
Standard Layout Typesstruct Foo { int a; Foo(int aa) : a(aa) { } }; Y Y Y Y
Defaulted and deleted functionsX& operator=(const X&) = delete; Y Y Y Y
Extended friend declarations Y Y Y Y
Extending sizeof Y Y Y Y
Inline namespaces Y Y Y Y
Unrestricted unions Y Y Y Y
Local and unnamed types as template arguments Y Y Y Y
Range-based forfor (auto x : vec) Y Y Y Y
Explicit virtual overridesvoid f() override; Y Y Y Y
Minimal support for garbage collection and reachability-based leak detection N N N N
Allowing move constructors to throw [noexcept] Y Y Y Y
Defining move special member functions Y Y Y Y

C++11 Core Language Features: Concurrency

Feature Example GCC 4.8.1 Clang 3.4 VS 2015 0 A.D. Support Notes
Revised sequence points Y Y Y Y N2239
Atomic operations Y Y Y Y
Bidirectional Fences Y Y Y Y
Memory model Y Y Y Y
Data-dependency ordering: atomics and memory model Y Y Y Y
Propagating exceptions Y Y Y Y
Abandoning a process and at_quick_exit Y Y Y Y
Allow atomics use in signal handlers Y Y Y Y
Thread-local storage Y Y Y Y
Dynamic initialization and destruction with concurrency Y Y Y Y

C++11 Core Language Features: C99

Feature Example GCC 4.8.1 Clang 3.4 VS 2015 0 A.D. Support Notes
__func__ predefined identifier Y Y Y Y
C99 preprocessor Y Y P P VS 2015 has partial support (Variadic macros are supported)
long long Y Y Y Y
Extended integral types Y N N N


  1. C++11 Support in GCC:
  2. Support For C++11 Features (Modern C++) in Visual C++:
  3. C++ Support in Clang:
  4. C++11/14 Core Language Features in VS 2013 and the Nov 2013 CTP:
  5. Using C++ in Mozilla code:
  6. Xcode Version Information:
  7. C++11 support in compilers:
  8. Expression SFINAE improvements in VS 2015 Update 3:
Last modified 9 days ago Last modified on May 17, 2020, 2:32:54 PM