News for hackers. Stuff that matters.
Re:All C++20 core language features with examples by MauranKilom on Wednesday April 07, 2021 @03:04PM (#26729465)
> Personally I judge code quality by a) Functionality (does it work, is it safe?), b) Readability c) Conciseness d) Performance and e) Extendibility, in this order, and I don't see how these new features in reality help move any of these meaningfully in the right direction.

I don't understand... How do these features not address those points?

> a) Functionality (does it work, is it safe?)

constinit, consteval and all the remaining constexpr improvements are a massive step for ensuring the "compile-time-ness" of code:

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

There's several more sharp edges being removed too. It's of course not going to tackle the fundamental safety concerns the way Rust is doing, but that would be a new language (like Rust is) anyway.

> b) Readability

requires is infinitely more readable than the SFINAE we had to write so far:

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

Besides that elephant in the room, most of these changes involve making the code either simpler to read/write (too many to name) or more explicit (consteval/constinit, attributes, ).

> c) Conciseness

Half the features contribute to this in one way or another (e.g. see previous point, or the spaceship operator), but there's also a whole list of syntactic sugar being added:

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

> d) Performance

What about coroutines?

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

> e) Extendibility

Various fixes to customization points:

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.ht...

Re:All C++20 core language features with examples by dgellow on Wednesday April 07, 2021 @03:18PM (#26729690)
Regarding "Readability", you mentioned requires (which is great), but ranges and views also make everything so nicer to read!
Re:All C++20 core language features with examples by MauranKilom on Wednesday April 07, 2021 @05:22PM (#26731507)
True, C++20 also comes with great library additions that are not the subject of this blog post but affect (possibly to an even greater degree) the code attributes in question.