How to use the hardened standard library?

-- Gaby




From: SG15 <sg15-bounces@lists.isocpp.org> on behalf of René Ferdinand Rivera Morell via SG15 <sg15@lists.isocpp.org>
Sent: Tuesday, October 14, 2025 9:58:48 AM
To: sg21@lists.isocpp.org <sg21@lists.isocpp.org>; ISO C++ Tooling Study Group <sg15@lists.isocpp.org>
Cc: René Ferdinand Rivera Morell <grafikrobot@gmail.com>
Subject: Re: [isocpp-sg15] [isocpp-sg21] P3835 -- Different contract checking for different libraries
 
On Tue, Oct 14, 2025 at 8:34 AM JOSE DANIEL GARCIA SANCHEZ via SG21 <sg21@lists.isocpp.org> wrote:
Knowing that a feature like "labels" is coming, I am happy with the
status quo for C++26, but we probably won't enable C++26 contracts for
anything that targets mixed contexts until we get labels. YMMV.

This means that you need a flag like -fno-contracts. Keep in mind that you will get preconditions/postconditions in certain functions from the standard library. 

It's almost certain you'll get that flag from compiler vendors. And very likely other flags with finer control.

--
-- René Ferdinand Rivera Morell
-- Don't Assume Anything  -- No Supongas Nada
-- Robot Dreams - http://robot-dreams.net