r/cpp • • Oct 24 '24

Why Safety Profiles Failed

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

347 comments sorted by

View all comments

Show parent comment

29

u/equeim Oct 25 '24 edited Oct 25 '24

The way I see it, profiles are mainly targeting "low hanging fruits" to achieve partial safety in old or new code, while dancing around the main problem of lifetimes/mutability. Meanwhile, safecpp tackles safety comprehensively in new code making some hard (unpopular?) choices, but doesn't address hardening of old code.

After listening to Herb Sutter's talks on safety and Cpp2 I think this is exactly what he believes is better for C++, yes.

4

u/RoyAwesome Oct 25 '24

but also doesn't cpp2 add more information and 'viral annotations' to cpp2? cpp2 has in inout out for references, and copy move and forward which basically shows that cpp doesn't have enough information in the language to achieve even the safety that cpp2 is trying to achieve in it's limited set of improvements.

15

u/domiran game engine dev Oct 25 '24

IMO cpp2 is tackling slightly higher-hanging fruit with those keywords. Personally I love the out keyword in C# and I hope C++ gets it, and the others.

4

u/Dooez Oct 25 '24

These annotation are local to the function (thus not viral) and except for `out` correspond directly to the normal cpp function parameter declarations.