C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] [isocpp-admin] Swedish mirror committee consideration on the current working draft

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 24 Sep 2025 17:26:38 +0300
On Wed, 24 Sept 2025 at 17:06, Harald Achitz via SG15
<sg15_at_[hidden]> wrote:
> Having some interest on the build issue myself, I would be thankful to learn about the following topics:
>
> Will it be easily manageable to tell the linker: hey, give me libfoo with contract assertions enabled, and that is using this special contract handler? And get an error if libfoo in that flavor is not available, but only in others other configuration.

I'm unaware of an implementation that allows you to choose the
contract evaluation semantic at link time. There's been talk about
that,
but no implementation yet. And, as <see below>, you can't have
per-library violation handlers. Except on Windows you might, which
is yet another unanswered question in the face of lack of both
implementation and deployment experience.

> or is it only easily manageable when you build the whole source tree including dependencies with profiles / tripplets, or what ever your control file is.

The contract evaluation semantic is chosen at compile-time. Which of
course means it isn't always easily manageable when you don't
(re-)compile every library you use.

> If you want to provide binary dependencies, does that mean you need to have each build in 4 variations, per contract variations.

We do not have the deployment experience that could easily give us
answers to such questions. It is possible to build just two variations
with the GCC implementations and do function contract assertion
checking on the caller side, but that would certainly mean that
library-internal contract_asserts are then off. We do not have an
option in that implementation to turn on contract_asserts but
leave function contract assertions off and leave them checked by callers.

> And is it even possible to have different contract handlers set, in dependencies, or do people make that up?

The C++26 Contracts do not support per-library violation handlers. But
on Windows you may end up getting such.

> What will, for example, Linux distributions add to their build, will it be implementation defined? And I can tell from the binary in the system what it is.

Again, we do not have the deployment experience that could easily give
us answers to such questions.

Received on 2025-09-24 14:26:52