r/cpp • • Oct 24 '24

Why Safety Profiles Failed

https://www.circle-lang.org/draft-profiles.html
178 Upvotes

347 comments sorted by

View all comments

Show parent comment

11

u/srdoe Oct 25 '24

Your objection doesn't make sense, because the proposal explicitly addresses gradual adoption:

https://safecpp.org/draft.html#a-safe-program

Note how you can enable the safe subset in specific files, which means you can adopt these safety constructs incrementally.

The reason it's not a reasonable request to avoid viral annotations is that there is no proposal that achieves memory safety without such annotations.

There's a loose ideas that profiles can maybe do it some day in the future if the stars align. However that hope is hard to trust, because not only do the prototypes fail to catch lots of real unsafety, Sean's document this thread is about outlines how profiles can't catch certain types of unsafety, because the source code simply doesn't contain the information that would be necessary to do so.

So this guideline essentially says "Don't address memory safety", because the only design on the table that tries to do that without viral annotations appears to have a bunch of gaps it doesn't cover.

5

u/ContraryConman Oct 25 '24

I'm not commenting on how adoptable safe C++ will be if approved into the standard. I've already read the proposal and know that the current idea is to do a per-file type of analysis. I'm only talking about the principles. The principle that future features in C++ should be backwards compatible with itself, and that we should avoid as much as possible features that are known to be difficult to adopt are not bad principles, and certainly no US government document is implicating wanting these things as the reason cyber attacks happen.

If we say, well if we want to achieve XYZ we have to deviate a little bit for a specific reason, then that's fine too. We say we like std::unique_ptr, but it violates the zero overhead principle in some cases. It's still in the standard, it's still incredibly useful. We just have to be respectful, that's my only point