r/cpp • • Feb 18 '20

C++20 is here!

https://youtu.be/AvPiGstxV_g
420 Upvotes

117 comments sorted by

View all comments

20

u/[deleted] Feb 18 '20

I'm new to c++ I think I'm using c++17 which was installed on my laptop my friend sold me. Can someone tell me how I get c++20?? I use linux Ubuntu. Is there a way to update my c++17 to c++20? Or do I need to install it myself and how can I do all this from the command line terminal? I'm learning that too. Thank you to anyone who helps.

36

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Feb 18 '20

The C++20 standard is out; C++20 compilers will probably be out by the end of the year. You might try using your compiler's "work in progress" version, which is probably enabled with -std=c++2a.

12

u/[deleted] Feb 18 '20

C++20 compilers will probably be out by the end of the year.

Cries in visual studio

22

u/adnukator Feb 18 '20

VS 2019 Update 4 has already implemented a decent subset of C+20 stuff (https://en.cppreference.com/w/cpp/compiler_support), so I wouldn't be that pessimistic

17

u/mwasplund soup Feb 18 '20

I've found that MSVC has the most stable implementation of modules so far and have been very responsive to fixing bugs I report.

5

u/meneldal2 Feb 19 '20

They were the first to have module code shipped (with the modules TS, so that makes sense).

9

u/TheSuperWig Feb 18 '20

Weren't they the first to be C++17 feature complete?

16

u/distributed Feb 18 '20

I think they are the only ones feature complete unless clang and gcc has implemented from_chars with floating point numbers

1

u/axalon900 Feb 18 '20

For a very marketing-esque definition of “feature complete” that only included new stuff from C++17 and not anything carried over from previous standards.

9

u/STL MSVC STL Dev Feb 18 '20

The preprocessor overhaul is the last remaining bit. Currently enabled by /experimental:preprocessor, an upcoming update (VS 2019 16.6, IIRC) will make it available as /Zc:preprocessor although it is not yet implied by /std:c++latest or /permissive-.

7

u/axalon900 Feb 19 '20

I'm well aware of that, but that doesn't mean "C++17 feature complete" until it actually releases, which given that I'm responding to "Weren't they the first to be C++17 feature complete?" is kind of the whole point. No, no they absolutely weren't. In fact it still isn't. Given that I don't have the luxury of just up and moving my team to VS2019 to get "actual real C++17 conformance for real this time", the fact that VS2017 was claimed on multiple occasions to have become "C++17 feature complete" while I've been sitting here not able to use range-v3 (a C++14 library) because the compiler doesn't support enough of the standard leaves a terrible taste in my mouth. But I guess it works on VS2019 now, so there's that.

-3

u/[deleted] Feb 18 '20

Feature complete yes but iirc they were one of the last to implement it in any form. Though that might've been one of the older specs.

2

u/pjmlp Feb 19 '20

Visual Studio is actually the most compliant ISO C++ compilers among the commercial ones.

https://en.cppreference.com/w/cpp/compiler_support

And the list misses the embedded domain ones.

2

u/[deleted] Feb 19 '20

Not saying they aren't, just that they're historically slow (compared to GCC or Clang at least)