mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.74k stars 439 forks source link

C++14, C++17 and forward #52

Open mosra opened 10 years ago

mosra commented 10 years ago

This used to be a list of exciting new features present in newer C++ standards to look forward to. Now it's rather a list of non-insance C++14+ features that could be worth backporting to C++11.

C++14

Compiler support

For all compilers we need to wait until their usage is similar to GCC 4.7 and Clang 3.2 just now (May 2014). We'll see after dropping GCC 4.7 support (#274).

Good resources about compiler support are at http://www.g-truc.net/project-0036.html for major vendors and also at http://en.cppreference.com/w/cpp/compiler_support for the other.

Features

STL features

The issue is that these won't be advertised in compiler release changelogs and thus we might have some very nasty surprises (e.g. std::map::emplace() didn't exist until GCC 4.8).

C++17

Compiler support

Features

STL features

C++20

Features

STL features

C++23

Features

STL features

Not yet

waddlesplash commented 9 years ago

MSVC 2014 (?) -- they implement both C++11 and C++14 simultaneously with varying success, so let's hope it is supported well enough in the next release

From experience with working with MSVC 2013, the C++11 support they added (at least std::thread & std::unique_ptr) was OK, but it took a few patch releases to get it fully working. So there's that added delay too...

TheAifam5 commented 6 years ago

Hmm what about to move everything to Clang (not GCC or MSVC) ? They are doing really good work, also with support for Windows platform: https://clang.llvm.org/docs/MSVCCompatibility.html Also on Linux there are tests to compile the Linux kernel with Clang compiler, Debian tries to re-compile all packages, Android uses also Clang (https://github.com/android-ndk/ndk/issues/26)...

Also MSVC installer actually have an option to install Clang with it (old version 6.0 i think).

I think, just wait only 5 months or 1 year and Clang will take over the MSVC compiler (I seen tweets that Clang actually started destroying MSVC compiler - they just moved from it) :D

I'm talking here about MSVC because is the most problematic platform. On Linux and Mac users can use Clang without any problems, but on Windows only MSVC or Cygwin-like stuff.

mosra commented 6 years ago

There are embedded Linux platforms that don't have the option to use Clang instead of GCC and I have important clients on these -- can't just drop GCC support :) Besides that, at the moment it's possible to just use a stock Ubuntu with whatever GCC is installed on it and that's a nice "plug and play" feature I wouldn't want to lose.

I'll introduce support for C++14 and 17 features on an opt-in basis (for example enabling constexpr for more APIs) -- if you enable the C++14/17 standard via a compiler switch, they'll be there, otherwise not. To avoid maintenance nightmares, these will affect mainly the public-facing API, the internal code will stay on C++11 as long as it's feasible.

ttnghia commented 3 years ago

@mosra C++20 mentioned, yeah 😛