C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] [isocpp-sg21] P3835 -- Different contract checking for different libraries

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 14 Oct 2025 21:03:06 +0300
On Tue, 14 Oct 2025 at 20:53, Ryan McDougall <mcdougall.ryan_at_[hidden]> wrote:
> Contracts are designed to be used in hardened libraries.

They don't seem to succeed at what you're telling them to be designed
for: https://isocpp.org/files/papers/D3878R0.html

> > It is highly non-obvious to me what actual benefits we gain from having multiple inline function definitions in the same program
>
> No one is shipping hardened inline contract-enabled functions.
>
> No one is building mixed-mode hardened applications from header-only contract-enabled libraries.

In the sense that nobody is shipping contract-enabled anything, sure,
but all our standard library implementations ship
hardened inline functions.

> When building a hardened library you tell the user how it should be used, and they use it the way you tell them

..and it is used in a way that doesn't include flipping the hardening
off by defining a contract evaluation semantic for your
own code, or flipping it off by linking in some other TU.

Received on 2025-10-14 18:03:22