You say "even if P2900 does not fix linking issues that are not inherent to Contracts”, but the point of P3835 is that the issues *are* inherent to contracts.
The reason for this is that if you currently use a macro like MY_LIB_ASSERT(x), then you have control over what it does, even when your header is used by someone else. If you fail to get this right, it is an ODR violation. So you have done something that makes your program ill-formed, and your tools might be able to detect this.
But if you use contracts, it is not an ODR violation, even when the functions end up doing different things.
So, contracts introduce a new problem that other mechanisms, including C assert, do not have.
John, are you opposed to implementations offering an option to specify the contract checking semantic at link-time, load-time or run-time as opposed to compile-time? Other language offer at least some such flexibility; for example, Java assertion enablement is decided at load-time.
One of the many things I appreciate about P2900 is that it takes the pressure off of the programmer to decide whether or not to write a contract assertion; they can freely author them with the understanding that someone else will choose the appropriate strategy for enabling them based on deployment scenario. I believe that flexibility is more important to the success of Contracts than the ability to guarantee that any particular assertion will always be evaluated with a particular semantic (and P3290 (Integrating Existing Assertions With Contracts) and P3400 (Specifying Contract Assertion Properties with Labels) will provide a solution for those that want such a guarantee for a specific contract assertion).
Perhaps the primary concern is that P2900 contracts does not expose a feature that suffices, without other implementation provided guarantees, to implement a hardened interface similar to what C++26 now offers thanks to P3471 (Standard Library Hardening)?
Tom.
John.
On Oct 13, 2025, at 5:21 PM, Ryan McDougall via SG21 <sg21@lists.isocpp.org> wrote:
Let's be very specific with our words -- "okay" and "safe" are not well defined terms with which we can make sound engineering decisions.While contracts can *help* Language Safety, Contracts do not need to be "Language Safe". Complaints that contracts are not "Language Safe" are misplaced. Contracts are a strict improvement for "Functional Safety" and that's justification enough -- even if P2900 does not fix linking issues that are not inherent to Contracts.
I did not claim that programs which may have UB are "okay" -- I'm saying that for decades we have made programs that may have UB to be made "Functionally Safe"" -- because "Functional Safety" does not depend on language guarantees. As p3578r1 explains, we got humans to the moon with assembly language. "Functional Safe" depends on Assurance -- ie. highly rigorous and structured testing.
_______________________________________________On Mon, Oct 13, 2025 at 1:20 PM John Spicer via SG15 <sg15@lists.isocpp.org> wrote:
I certainly hold Ryan in high regard, but I don’t understand how the situation described in P3835 can be considered “okay”._______________________________________________
As P3835 says, the library with l1.cpp is built with the quick_enforce semantic. c1.cpp is compiled with the ignore semantic.
If the line in red is removed, the program will fail the assertion. If the line in red is present, the program might not fail the assertion.
Maybe Ryan and you are okay with that behavior.
I’m not.
John.
file: z.h inline void f(int x) { contract_assert(x > 0); } file: l1.cpp #include "z.h" void g() { f(0); // expected to fail contract } file: c1.cpp #include "z.h" extern void g(); int main() { f(1); // expected to pass contract g(); }
On Oct 13, 2025, at 2:48 PM, Gideon Mueller via SG21 <sg21@lists.isocpp.org> wrote:
100% agree with what Ryan wrote!
I fail to see how “the problem” stated in P3835 is specific to contracts and why a contracts /MVP/ should be considered responsible for solving it. If it got covered in the email thread I missed it, could the authors please expand on this or point to where they did?
PS: maybe the issue is on my end, but I am unable to access https://contracts.efcs.ca/#contract-groups, does anyone have an alternative link?
RegardsGideon_______________________________________________
SG21 mailing list
SG21@lists.isocpp.org
Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/sg21
Link to this post: http://lists.isocpp.org/sg21/2025/10/11233.php
SG15 mailing list
SG15@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg15
SG21 mailing list
SG21@lists.isocpp.org
Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/sg21
Link to this post: http://lists.isocpp.org/sg21/2025/10/11237.php
_______________________________________________ SG21 mailing list SG21@lists.isocpp.org Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/sg21 Link to this post: http://lists.isocpp.org/sg21/2025/10/11243.php