On Tue, 3 Jun 2025, 19:29 Simon Schröder via Std-Proposals, <std-proposals@lists.isocpp.org> wrote:

On Jun 1, 2025, at 10:32 AM, Thomas Krogh Lohse via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

I’d love to hear your thoughts:
    * Do you see value in defining a "safe-by-default" C++ subset with opt-in unsafe features?

“Safe-by-default” will not work. C++ always tries to be backwards compatible and old (currently correct) code might not compile with your feature on.

Narrowing conversions became ill formed. Some lambda captures have been deprecated (and are not ill formed? I don't remember). Asymmetric equality operators became ill formed. 

I don't think "old code must compile" is always such a hard line.


Currently, there are several proposals for so-called profiles (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3589r0.pdf can give a good start into this topic with additional references at the bottom of this proposal).

Your work should nicely fit into these profiles or add a new profile. Some of it is quite closely related, though profiles don’t discuss a borrower checker, yet. “Safe-by-default” could, however, be a compiler flag that turns on certain profiles by default. This might be the safest you can get without running against some of the core C++ philosophies.

(The goto discussion could also be solved by profiles.)
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals