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
1
u/germandiago Oct 28 '24 edited Oct 28 '24
Thanks for the feedback. At this point I am gathering all information in a document. In order to use "exclusive aliasing" there is a need to either recompile or add a form of limited paramter passing (in/out/inout maybe?) that could recognize the aliasing rules directlly, but requires using those keywords and withoit recompile it would be "trusted code" bc the analysis could not be done (oh just got an idea, will add to the document later :)).
It is true that, as far as my knowledge goes, combining something with old code cannot guarantee you aliasing safety at compile-time.
What can be done in those situations as a fallback is to inject run-time aliasing checking at the caller side as a fallback but that could be of concern for run-time performance. Another alternative is to just assume the code can alias and use it only in "alias-unsafe" code in its corresponding context when not recompiling.
Leaning only on pure C++ signatures without any other metadata does not let you go further. I would still find valuable, though, having full analysis available without doing a syntax split. It is just too valuable to throw it away.
Note that this would require analysis from the compiler to code, but Safe C++ would require direct rewriting so I still consider this subset of circumstances more desirable.
Also, as you say, for things like MS dll, this needs extra work, but there are a lot of packages you can consume and compile with Conan, for example, that would be eligible for incremental hardening. I still think this is worth to pursue.