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: Wed, 15 Oct 2025 00:14:26 +0300
On Wed, 15 Oct 2025 at 00:10, Louis Dionne <ldionne.2_at_[hidden]> wrote:
> But, just to be clear, many large adopters will need the ability to select the observe semantic in order to deploy this at a large scale. That's an extremely useful tool to have. I don't care if that's not called a "Hardened Implementation", but it should be possible.

I'm quite certain they will want to select observe for specific cases,
like the one that the paper mentions,
vector::operator[] where you invoke it for e.g. the use case
&vec[vec.size()]. I do not think they want an observe semantic
library-wide,
because that will just give them UB for the cases where no such benign
case exists.

> TLDR: I think the first wording suggestion in your paper makes sense. That makes only `enforce` and `quick_enforce` be valid evaluation semantics for Hardened Implementations and removes `observe`. Contracts and hardening are still useful with the Contracts MVP, and they'll be more useful once we have additional Contracts features like tagging. That's not a reason to kill either.

That's debatable, but this paper is indeed not about whether there's
reasons to kill contracts.

Which, by the way, nobody has suggested. Moving contracts to a non-IS
ship vehicle doesn't kill them.

Received on 2025-10-14 21:14:41