Date: Mon, 20 Oct 2025 10:18:20 -0400
On Mon, Oct 20, 2025 at 10:12 AM Ville Voutilainen <
ville.voutilainen_at_[hidden]> wrote:
> On Mon, 20 Oct 2025 at 16:58, Joshua Berne <berne_at_[hidden]> wrote:
> > C++26 Contracts *also* let vendors provide you an option that says
> "don't let me link TUs when the TUs have different contract configurations"
> or even better options like "warn me if i link builds where the same
> function has been built with different contract configurations". Build
> configurations are outside the standard, and platforms are completely free
> to define when they do and don't work together, and to provide support for
> enforcing that rule. Nothing in C++26 Contracts prohibits this possibility.
>
> There's nothing in Contracts that allows for it. And then
> https://eel.is/c++draft/intro.compliance#general-2.1
> says "hi".
>
You are looking for something about build flags in a standard that says
nothing about build flags. As far the C++ standard is concerned there is
no distinction between one compiler being invoked with different build
flags and two compilers that are unrelated compilers with no onus of
compatibility whatsoever.
`g++ -fnoexceptions` is one platform, `g++` is a different platform, and
the standard never once claims that you must be able to combine TUs built
in both ways to get a program.
Any cases where you *can* mix object files compiled by different compilers
(be they different versions, the same version using different flags, or
even completely different implementations such as clang and gcc) the
results you get and how conforming they are to the C++ standard are defined
by the agreements you have between those different compiler invocations and
what they have or have not done to support working together (or to actively
prevent working together when that would be in user's best interest).
ville.voutilainen_at_[hidden]> wrote:
> On Mon, 20 Oct 2025 at 16:58, Joshua Berne <berne_at_[hidden]> wrote:
> > C++26 Contracts *also* let vendors provide you an option that says
> "don't let me link TUs when the TUs have different contract configurations"
> or even better options like "warn me if i link builds where the same
> function has been built with different contract configurations". Build
> configurations are outside the standard, and platforms are completely free
> to define when they do and don't work together, and to provide support for
> enforcing that rule. Nothing in C++26 Contracts prohibits this possibility.
>
> There's nothing in Contracts that allows for it. And then
> https://eel.is/c++draft/intro.compliance#general-2.1
> says "hi".
>
You are looking for something about build flags in a standard that says
nothing about build flags. As far the C++ standard is concerned there is
no distinction between one compiler being invoked with different build
flags and two compilers that are unrelated compilers with no onus of
compatibility whatsoever.
`g++ -fnoexceptions` is one platform, `g++` is a different platform, and
the standard never once claims that you must be able to combine TUs built
in both ways to get a program.
Any cases where you *can* mix object files compiled by different compilers
(be they different versions, the same version using different flags, or
even completely different implementations such as clang and gcc) the
results you get and how conforming they are to the C++ standard are defined
by the agreements you have between those different compiler invocations and
what they have or have not done to support working together (or to actively
prevent working together when that would be in user's best interest).
Received on 2025-10-20 14:18:37
