This page will attempt to describe features of modern C++ standards (C++0x, 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.7 or newer * Clang 3.1 or newer * Shipped with Xcode 4.3.3 on OS X * '''Note:''' older versions may work, but this isn't guaranteed * Visual Studio 2013 The following tables summarize C++1x 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.7 =||= Clang 3.1 =||= VS 2013 =||= '''0 A.D. Support''' =||= Notes =|| {{{#!tr style="background: LightYellow" ||Emplacement||`emplace`, `emplace_back`|| P || Y || Y || P || GCC < 4.8 is missing emplacement on [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44436 associative containers] || }}} {{{#!tr style="background: LightYellow" ||Rvalue references||`type_t &&`|| Y || Y || P || Y || VS 2013 has [https://msdn.microsoft.com/en-us/library/hh567368.aspx#rvref partial] support || }}} {{{#!tr style="background: Pink" ||Rvalue references for *this||`void RValueFunc() &&;`|| N || N || N || N || || }}} {{{#!tr style="background: LightGreen" ||Initialization of class objects by rvalues|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Non-static data member initializers||`class Foo{ public: int bar=7; };`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Variadic templates||`template`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Extending variadic template template parameters|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Initializer lists||`vector v = { 1, 2, 3, 4, 5, 6 };`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Static assertions||`static_assert(expression,message);`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||auto-typed variables|| `for (auto p = v.begin(); p!=v.end(); ++p)` || Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Multi-declarator auto||`for (auto p = v.begin(), e=v.end(); p!=e; ++p)`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Removal of auto as a storage-class specifier||~~`auto int r;`~~|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||New function declarator syntax|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||New wording for C++0x lambdas|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Declared type of an expression||`typedef decltype(a[0]*b[0]) Tmp;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Incomplete return types|| || N || Y || Y || N || || }}} {{{#!tr style="background: LightGreen" ||Right angle brackets||`list> lvs;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Default template arguments for function templates|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Solving the SFINAE problem for expressions|| || Y || Y || N || N || || }}} {{{#!tr style="background: LightGreen" ||Template aliases||`template using Vec = vector>;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Extern templates||`extern template class Foo;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Null pointer constant||`char* p = nullptr;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Strongly-typed enums||`enum foo : int {};`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Forward declarations for enums||`enum class Foo : char;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Generalized attributes||`[[attributes]]`|| N || N || N || N || || }}} {{{#!tr style="background: Pink" ||Generalized constant expressions||`constexpr int a = b.x;`|| Y || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Alignment support||`alignas(16) char[100];`|| N || N || P || N || || }}} {{{#!tr style="background: LightGreen" ||Delegating constructors|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Inheriting constructors|| || N || N || N || N || || }}} {{{#!tr style="background: LightGreen" ||Explicit conversion operators||`explicit operator bool()`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||New character types||`char16_t` / `char32_t`|| Y || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Unicode string literals||`u"string"`|| Y || Y || N || N || || }}} {{{#!tr style="background: LightGreen" ||Raw string literals||` r"\string!\";`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Universal character name literals|| || Y || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Extensible literals||`std::string operator""s (const char* p, size_t n)`|| Y || Y || N || N || || }}} {{{#!tr style="background: LightGreen" ||Standard Layout Types||`struct Foo { int a; Foo(int aa) : a(aa) { } };`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Defaulted and deleted functions||`X& operator=(const X&) = delete;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Extended friend declarations|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Extending sizeof|| || Y || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Inline namespaces|| || Y || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Unrestricted unions|| || Y || Y || N || N || || }}} {{{#!tr style="background: LightGreen" ||Local and unnamed types as template arguments|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Range-based for||`for (auto x : vec)`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: LightGreen" ||Explicit virtual overrides||`void f() override;`|| Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Minimal support for garbage collection and reachability-based leak detection|| || N || N || Y || N || || }}} {{{#!tr style="background: Pink" ||Allowing move constructors to throw [noexcept]|| || Y || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Defining move special member functions|| || Y || Y || N || N || || }}} == C++11 Core Language Features: Concurrency == ||= Feature =||= Example =||= GCC 4.7 =||= Clang 3.1 =||= VS 2013 =||= '''0 A.D. Support''' =||= Notes =|| {{{#!tr style="background: Pink" ||Sequence points|| || N || N || N || N || || }}} {{{#!tr style="background: LightGreen" ||Atomic operations|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Bidirectional Fences|| || N || Y || Y || N || || }}} {{{#!tr style="background: Pink" ||Memory model|| || N || N || N || N || || }}} {{{#!tr style="background: Pink" ||Data-dependency ordering: atomics and memory model|| || N || N || Y || N || || }}} {{{#!tr style="background: LightGreen" ||Propagating exceptions|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Abandoning a process and at_quick_exit|| || N || N || N || N || || }}} {{{#!tr style="background: Pink" ||Allow atomics use in signal handlers|| || N || Y || N || N || || }}} {{{#!tr style="background: Pink" ||Thread-local storage|| || N || N || P || N || || }}} {{{#!tr style="background: Pink" ||Dynamic initialization and destruction with concurrency|| || N || N || N || N || || }}} == C++11 Core Language Features: C99 == ||= Feature =||= Example =||= GCC 4.7 =||= Clang 3.1 =||= VS 2013 =||= '''0 A.D. Support''' =||= Notes =|| {{{#!tr style="background: Pink" ||!__func!__ predefined identifier|| || Y || Y || P || N || || }}} {{{#!tr style="background: LightYellow" ||C99 preprocessor|| || Y || Y || P || Y || VS 2013 has partial support || }}} {{{#!tr style="background: LightGreen" ||long long|| || Y || Y || Y || Y || || }}} {{{#!tr style="background: Pink" ||Extended integral types|| || N || N || N || N || || }}} = References = 1. C++0x/C++11 Support in GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx11 1. Support For C++11 Features (Modern C++) in Visual C++: https://msdn.microsoft.com/en-us/library/hh567368.aspx 1. C++ Support in Clang: http://clang.llvm.org/cxx_status.html 1. C++11/14 Core Language Features in VS 2013 and the Nov 2013 CTP: http://blogs.msdn.com/b/vcblog/archive/2013/12/02/c-11-14-core-language-features-in-vs-2013-and-the-nov-2013-ctp.aspx 1. Using C++ in Mozilla code: https://developer.mozilla.org/en-US/docs/Using_CXX_in_Mozilla_code 1. Xcode Version Information: https://trac.macports.org/wiki/XcodeVersionInfo 1. C++11 support in compilers: http://www.klayge.org/wiki/index.php/C%2B%2B11_support_in_compilers