Hacker News new | past | comments | ask | show | jobs | submit login

Having left the C/C++ professional programming world several years back to wallow in other pastures, I've lost close touch with the languages except at a low-key hobbyist level. That said, I am curious over what is the motivation to pursue updates in 20 and 23? Are there really new features promised that today's programmer simply can't live without or are they all various levels of syntactic sugar or something in between? Is there a concern over whether these changes are making the language ever more complex and obese thus making mastery even harder to achieve?



> what is the motivation to pursue updates in 20 and 23?

For C++20:

* Ranges! With may range operations and views

* Expansion of ability of compile-time computation, including a lot of standard library code.

* Concepts - constrained templates

* 3-way comparisons with spaceship operator + automatic comparisons generation.

* You can write your own modules (Java-esque import rather than textual inclusion)

* Support (albeit ugly) for co-routines

* Spans: https://stackoverflow.com/q/45723819/1593077

* Parallelism primitives

* Asynchronous network operations in the standard library (Boost-ASIO-based IIANM)

* Can safely implement scope guards

For C++23:

* Standard library via modules

* Stack traces (e.g. in exceptions)

* Many range views/algroithms/adapters

* Expected: https://stackoverflow.com/q/68368581/1593077

* Monadic semantics for std::optional

* etc.

> Are there really new features promised that today's programmer simply can't live without

Well, people can live with a lot. Many people write C, after all... so you could ask that about any language undergoing long term development.


> Can safely implement scope guards

Can you elaborate on this?


A count of the number of exceptions in-flight was added, replacing the boolean indication of whether an exception is in-flight. This allows the scope guard construct proposed by Andrei Alexandrescu to distinguish between a scope being left on success and on an exception being thrown.

YouTube video about scope guard: https://www.youtube.com/watch?v=WjTrfoiB0MQ

Description of the change to the standard: https://isocpp.org/files/papers/N4152.pdf


I can’t speak for all of C++20/23 but I was impressed by Concepts which finally make template compile errors legible


One of the things I've mostly been looking at is the additions to the standard library. Especially the new <stacktrace> header looks like something that should have been in the language already.


I like the new <bit> header. In C++/20 they added support for BSR and BSF instructions from 1985, introduced in Intel i386. In C++/23 they even added BSWAP instruction, much newer one, introduced in 1989, in Intel i486. Most other instruction sets (ARM, Power, etc) have equivalents of these instructions.

Currently I use C++/17, have to rely on compiler-specific intrinsics. They work fine in practice, but standard library functions are IMO better.


> Having left the C/C++ professional programming world several years back to wallow in other pastures.

As someone who wants to follow the same trajectory, how did you do it? And how did you dissociate professionally from being seen as the C++/systems guy?


Having gone through a very similar journey, it took around 2 years for me to completely disassociate myself from a specific programming language. It was more a 'me' problem since I leaned on to a programming language rather than a problem domain.

I still consider myself a systems programmer mostly writing glue code in Go/Python and jumping into C/C++ as required to improve performance when required.


I have a bachelor and master of EE. My first job out of college starting my programming career (in Fortran), eventually moving to C and then C++. As my career progressed, I made myself into a software systems engineer. After several years of that, I started taking on full blown systems engineering things which I greatly enjoyed. That started my distancing from software development, mainly from interests but also because I became to expensive to write code. Fortunately, the companies I worked for were willing to support my career goals. YMMV.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: