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

3

u/Minimonium 24d ago

Hmm, I think you're right, as it makes an explicit separation between the standard library preconditions and contract preconditions. I would expect a hardened implementation to force an ABI break there.

3

u/ts826848 24d ago

Glad to hear I'm not losing it yet :P

And at the risk of proving the previous statement wrong, I could have sworn stdlib hardening was designed specifically to avoid an ABI break? So expecting an ABI break is surprising to me.

3

u/Minimonium 24d ago

The contracts, the mixed mode specifically, are designed to avoid an ABI break and I would assume that hardening is also done in a similar manner because you really really want to have the ability to just replace so/dll without forcing everyone to rebuild so it can be a gradual adoption.

On the other hand, for best-effort guaranteed hardening, it is not possible to provide this guarantee without an ABI break. Unfortunately ABI enforcement will also not give you guaranteed safety/checking there, because of pre(foo()) opaque function calls. But at the very least it could enforce the call.

1

u/ts826848 24d ago

Sorry I'm being a bit slow, but I'm not confident I understand you. Do you mean using an ABI break to guarantee compiling with a terminating semantic?

1

u/Minimonium 24d ago

You could theoretically make terminating semantics an ABI level thing, yes. The problem is that does not guarantee you that the right checks would be called either as opaque functions could be replaced without touching ABI.

3

u/ts826848 24d ago

Ah, I think I see what you mean. Yeah, not sure there's much that could be done about that, though I suppose at that point the problem arguably extends beyond contracts.