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

Improve -preview=safer changelog entry #17490

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion changelog/dmd.safer.dd
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
This adds `-preview=safer` which enables safety checking on un-attributed functions.
Add `-preview=safer` switch for safety checking on unattributed functions

All the checks currently enabled in `@safe` code, that are easily fixed (as in
the fix is constrained to the function), will be enabled in `-preview=safer` code.

Code not easily fixed, such as calls to `@system` or unattributed functions, will
be allowed as before.

---
void f();
@system void g();

void main()
{
int* p;
p++; // Error, pointer arithmetic
f(); // allowed
g(); // allowed
}
---

For more information, see: [safer.md](https://github.com/WalterBright/documents/blob/38f0a846726b571f8108f6e63e5e217b91421c86/safer.md)
Loading