News for hackers. Stuff that matters.
Re:C++20 Modules with GCC11 by tialaramex on Thursday August 19, 2021 @06:21PM (#28240091)
Right, you want to wrap this code, exactly like Rust.

The point isn't that this is impossible it's that in both cases you want to write a wrapper to use them ergonomically in your modern software, C++ doesn't magically make 1980s code more respectful of object lifetime management than you'd think by reading Stroustrup's book at the time just because modern C++ (and the modern edition of the book) spends more time on this problem.

I think Jason Turner put together a little example about this type of wrapping as the more sane way forward for people who've persuaded themselves they can't stomach a C++ ABI change because they have binaries with no source or their system is too complicated to re-test. Maybe as a C++ Weekly.

Re:C++20 Modules with GCC11 by jcelerier on Friday August 20, 2021 @01:48AM (#28243061)
> Right, you want to wrap this code, exactly like Rust

In theory. In practice if it's a one-off task I'm definitely not going to bother and will just use the 1981 API directly, especially if it's used in a single file for instance. There's nothing I find more stupid than code style dogmatism - if it compiles it's kosher in the right circumstances.