C++ Logo

sg15

Advanced search

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

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Wed, 15 Oct 2025 03:50:17 +0000
+1.

-- Gaby



________________________________
From: SG15 <sg15-bounces_at_[hidden]> on behalf of Ville Voutilainen via SG15 <sg15_at_[hidden]>
Sent: Tuesday, October 14, 2025 5:14:26 PM
To: Louis Dionne <ldionne.2_at_[hidden]>
Cc: Ville Voutilainen <ville.voutilainen_at_[hidden]>; sg15_at_[hidden] <sg15_at_[hidden]>; sg21_at_[hidden] <sg21_at_[hidden]>
Subject: Re: [isocpp-sg15] [isocpp-sg21] P3835 -- Different contract checking for different libraries

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.
_______________________________________________
SG15 mailing list
SG15_at_[hidden]
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.isocpp.org%2Fmailman%2Flistinfo.cgi%2Fsg15&data=05%7C02%7Cgdr%40microsoft.com%7C249478e9d2a04505e5cb08de0b66b2d5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638960732902943310%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=VR2RKMo1AJTDpYiSC8ANRlDb6GocrG59MEmQyxdE3Ww%3D&reserved=0<https://lists.isocpp.org/mailman/listinfo.cgi/sg15>

Received on 2025-10-15 03:50:23