r/cpp
•
u/steveklabnik1
•
Oct 24 '24
•
1
Why Safety Profiles Failed
https://www.circle-lang.org/draft-profiles.html
180
Upvotes
View all comments
Show parent comment
-2
u/germandiago Oct 25 '24
Little time now but basically non-const functions (in a Bjarne paper) would assume that calling a non const func would invalidate pointers (in this model iterators, spans, string_view, etc.) are also pointers.
In order for the type system to know this is not the case it does need an annotation in this case. [[not_invalidating]] annotation I think he called it. Of course that is not a final proposal but a strategy to del with such things.
Everything else would be assumed unsafe (I mean if not marking things correctly). Conclusion: it does not leak unsafety.
The point here is to understand that this strategy is more potentially more conservative than Safe C++ but also more compatible and there is no reason for it to leak. It is usable? I think that yes. But no full implementation exists yet.
C++ type system cannot solve all.
This is about subsets that do not leak. There are different such subsets.