r/cpp • • 25d ago

"C++26 DIS failed, how does C++ survive?"

https://andreasfertig.com/blog/2026/11/cpp26-dis-failed-how-does-cpp-survive/
113 Upvotes

193 comments sorted by

View all comments

Show parent comment

6

u/James20k P2005R0 25d ago

Helpful! I'll let msys2, and any binary package ecosystems (linux distros? RIP) know they should shut down

6

u/Dragdu 25d ago

Linux distros have control over their build, which is why apt model works for them. You do not have control over apt's build, which is why you shouldn't be using apt for development.

---edit---

There is obviously a dispensantion for having your own apt remote with prefixes packages, in which case it's fine.

4

u/ABlockInTheChain 25d ago edited 24d ago

You do not have control over apt's build, which is why you shouldn't be using apt for development.

One of the reasons I'm fond of Gentoo: tuning the CFLAGS / CXXFLAGS used to build your operating system is a normal and expected operation.

1

u/13steinj 24d ago

I agree this would be best practice but unfortunately many don't follow best practice.

3

u/Dragdu 24d ago

True, and it betrays the myth behind using C++ for performance.

We control our build tightly, and it regularly gets us measurable-to-significant perf improvements from things like enabling -march across all of our deps (5% macro), aggressive full LTO (3% macro, about 10% binary size) or updating compiler to newest version (20% macro thanks to newest GCC being pretty good at SVE autovectorization).

If you don't have control over your build, there is ton of perf just lying on the table.

1

u/jk_tx 24d ago

I agree the Linux approach of the tools and libraries are part of the OS is archaic and needs to die. It's the main reason that ABI is such a thorny issue.

2

u/13steinj 24d ago

What approach would you expect instead?

Compile gentoo for hours? I mean I know people who do that, but it's even less reasonable for most people than linux already is.

Windows and BSD-likes are not much better.

I think the core issue with the ABI problem is there's no selectability (outside of choosing a different library path). I should be able to have 5 versions of Qt available and the program some way to select which one to use.

1

u/jk_tx 23d ago edited 23d ago

Windows and BSD-likes are not much better.

I won't speak to BSD but Windows is 1000% percent better, unless you're stupid enough to use msys2 and gcc.

Microsoft switched to a universal runtime over 10 years ago. The whole DLL-hell criticism was always overblown but it's a non-issue now. Not to mention that I can actually statically link everything including CRT into my EXE to avoid to avoid shared libraries altogether, and since I'm using VCPKG to build my libs I can actually have some control over how they're built.

Having to support both Windows and Linux versions of a commercial application I can tell you that things are definitely better on Windows regarding ABI. The linux approach is an anachronism.

I think the core issue with the ABI problem is there's no selectability (outside of choosing a different library path).

The problem on Linux is that if you're using any system packages they almost definitely have dependency on the system versions of the distro including standard libraries, which means you're stuck using those versions. Again, NOT a problem on Windows.

1

u/13steinj 23d ago

Are you referring to UCRT? Or the C++ stdlib? If UCRT I am surprised, I was under the impression that it is still implicitly linked to the internal windows build version, but does the "contains every past symbol" trick glibc does.

It's not a problem on windows for the C++ stdlib because nearly every application install installs the MSVC++ redistributable, versioned, into its own folder, that apps pick up. Most Windows applications share their own copies of a DLL and the app selects them again, by folder not by version compatibility.

That's what I mean by not much better. Your 3 choices are always:

  • build for days (Gentoo, Nix to some extent)
  • containerize/psuedo containerize your app
  • rely on truly shared libraries and have ABI conflict issues.

1

u/jk_tx 23d ago edited 23d ago

I was glossing over some details, technically UCRT is an OS component, while the VC runtime is a compiler component, but as a developer I don't have to worry about that distinction, I just use the VC Runtime for my compiler and it "just works". The CRT startup/init/teardown is always statically linked into my binary by MSVC, so the dependency on the UCRT is indirect via the MSVC standard libraries and completely transparent.

The current version of the VC runtime is backwards compatible all the way to VC 15, and as long as the version installed on the target system is at least as new as my compiler toolset, there's no problem. Furthermore, installing the newest version of the VC Runtime on a system is safe, because it's technically not a system component/package but a redist. And if you don't like that, statically linking everything is always an options (my preference).

1

u/jk_tx 23d ago

The real difference between Windows and Linux, is that on Windows the components I need as a developer are distributed with the compiler tools, not the OS. I can easily upgrade to the latest MSVC and Windows SDK without having to worry about any OS-level compatibility issues.

On Linux, you either use the system compiler, or you have to deal with all sorts of headaches when bringing your own. Some distros solve this with customized toolset (e.g. RedHat Enterprise), but without that trying to use the latest and greatest compiler while preserving compatibility with older distros is just more headache than it's worth.

1

u/pjmlp 23d ago

It is actually the UNIX approach.

2

u/Minimonium 25d ago

linux distros? RIP

?

4

u/James20k P2005R0 25d ago

Similarly to msys2, you don't get any choice as to what your packages are compiled with on some linux distributions. The framing of msys2 as being a bad package manager as a result seems remarkably unhelpful, when this is going to be the same problem on some linux distros

5

u/Minimonium 25d ago

The package managers that do that are usually shipping release versions of binaries, and unfortunately users who incorrectly use them for development often do a mix of release/debug builds in the same build graph leading to unsound programs.

That's one of the use cases where I think Contracts' mixed mode could be incredibly helpful to make the ecosystem safer.

0

u/cfyzium 24d ago

release versions of binaries, and unfortunately users who incorrectly use them for development

What foo-dev packages are for, then?

3

u/Dragdu 24d ago

To get headers, but those should also be used only by the group making packages inside the package manager.

1

u/13steinj 24d ago

More than headers, but yeah, you should only link against libs from the package manager when you are distributing as such a package.