Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make safety opt-out rather than opt-in, or at least less verbose #74

Open
nihil-admirari opened this issue Nov 12, 2024 · 1 comment
Open

Comments

@nihil-admirari
Copy link

  1. According to the current proposal, all new code in C++ will have to designate every function as safe, which is quite tedious. Maybe makes sense to make top-level #feature on safety automatically mark every function in the translation unit as safe without the need to repeat oneself?
  2. C++11 changed auto from a storage specifier into a type inference facility in a backward incompatible fashion, assuming that auto wasn't really used in pre-C++11 code. C++20 introduced modules, which are currently supported by only one compiler. Would it be possible to make modules safe by default in a backward-incompatible way (just like with auto), exploiting the fact that modules are still essentially unused? Or to introduce export safe module in which you don't have to keep writing safe all the time?
@igaztanaga
Copy link

Another idea would be to use some kind of namespace level "safe" attribute so that all included functions/types are safe by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants