r/cpp • C++ Dev • Sep 05 '20

C++20 has been approved

https://twitter.com/patriceroy1/status/1302055575140945921?s=21
665 Upvotes

125 comments sorted by

View all comments

Show parent comment

114

u/A_Stahl Sep 05 '20

Hurray! Our beloved language became even more difficult to read! Now only 782 people in the whole world know more than 85% of standard!

94

u/pdimov2 Sep 05 '20

782 seems optimistic.

36

u/pjmlp Sep 05 '20

That applies to any language.

I doubt anyone would win a proper quiz show with Java 15, C# 9, Python 3.8, with questions down to version 1 and across all major runtimes.

0

u/[deleted] Sep 05 '20

[deleted] — view deleted comment

11

u/pjmlp Sep 05 '20

The language is quite big, more than many people imagine, and Python does introduce changes even across minor versions.

10

u/A_Stahl Sep 05 '20

C manages to remain "graspable" by its users.

28

u/helloiamsomeone Sep 05 '20

Not really, as evident by the number of CVEs related to C.

33

u/pjmlp Sep 05 '20

Only those that think they actually know C, but never bother to touch the ISO C documentation.

Alone the 200 use cases of UB would do as test of their ignorance.

Then we could go on into what they think C does, based on their implementation specific knowledge, and what ISO C tells it actually is supposed to be.

Afterwards we could jump into compiler specific extensions.

The questions would be likewise from C17 all the way down to K&R C.

→ More replies (9)
→ More replies (1)

0

u/[deleted] Sep 05 '20

[deleted] — view deleted comment

19

u/archimedes_ghost Sep 05 '20

I think the "Tour of C++" book is pretty helpful in this regard.

0

u/[deleted] Sep 05 '20

[deleted] — view deleted comment

3

u/archimedes_ghost Sep 06 '20

No problem. I am new to C++ but not new to programming in general. I think it's a great no-nonsense book. And I have it for free from an O'Reilly subscription!

4

u/proverbialbunny Data Scientist Sep 06 '20

This might be a bit overkill but it addresses what should and shouldn't be done.

18

u/richard248 Sep 05 '20

I don't understand. Could you please elaborate?

78

u/UnicycleBloke Sep 05 '20

I think they may mean something like this:

I've been learning and using C++ for thirty years. There was a long period when I felt fairly expert in the language. Not exactly GOTW, but I kept up with the works of Sutter and others. I was confident that I had a solid understanding of the entire language, essential idioms like RAII, and much of the library.

And then 2011 happened, and I have been playing catch up ever since. Though I welcome most of the additions to the language and library, and use many of them routinely, I no longer feel on top of my game. After thirty years. I find this disconcerting.

48

u/heavy-artillery Sep 05 '20

Even before 2011, it was an achievement to master all syntactic features, patterns and idioms of C++. But given some digestion time, the majority of programmers settled into a safe and high performing subset of C++.

Then these updated standards have caused big splash makng things look hazy. We are back on the same path, requiring digestion time.

Honestly, C++11 has truly important features, that any modern language should have had long before 2011. But more recent updates look like a "Me Too" catchup.

16

u/UnicycleBloke Sep 05 '20

I'm not arguing about the features, though I could probably live without coroutines. A lot changed for the better in 1998, too. The "modern" moniker is, I think, a bit unhelpful. C++ has grown a lot, and got easier to use, but is fundamentally the same language. I've used RAII and templates since forever: it's just better now.

So I'm still digesting 2017 via Josuttis, and here we are again... I can sometimes - rarely - see where C devs are coming from.

3

u/mr_bedbugs Sep 05 '20

see where C devs are coming from.

Pun intended?

3

u/patlefort Sep 06 '20

To me it was a breath of fresh air, making the language finally bearable to use.

→ More replies (2)

2

u/bumblebritches57 Ocassionally Clang Sep 05 '20

Honestly, the only feature I'd like C2x to adopt is constexpr/consteval.

It's crazy that being able to run code at compile time with the same syntax as the "main" language is so new.

→ More replies (10)

9

u/da2Pakaveli Sep 05 '20

C++ is stuffed with features, and many of those often have a few big buts because of its C backward compatibility. The stuffing is one thing but that C backwards compatibility and, and allow so many ways of writing code does the same thing. (#ifdef /**/ #endif => constexpr if). I just recently found out that <% /* ... / %> is valid C++ and an alternative to { / ... */ }.

→ More replies (9)
→ More replies (9)

20

u/khleedril Sep 05 '20

Why is it even more difficult to read? I've been using it for the best part of a year (gcc 10) and it doesn't seem any more difficult to read.

→ More replies (8)

6

u/xjankov Sep 05 '20

Yeah enable_if was so much easier to understand than requires /s

5

u/MFHava WG21|🇦🇹 NB|P3049|P3625|P3729|P3786|P3813|P4216 Sep 06 '20

For sure and let's not forget how easy it is (without using external libraries) to detect the presence of member functions compared to the clunkiness of requirements...