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

enumerate all kinds of undefined behavior, even that which cannot be safety-checked #1966

Open
andrewrk opened this issue Feb 15, 2019 · 2 comments
Labels
Projects
Milestone

Comments

@andrewrk
Copy link
Member

@andrewrk andrewrk commented Feb 15, 2019

The language reference should have a comprehensive list of every of possible undefined behavior that is possible, with a description of either how safety checks work for it, and under what circumstances the safety check will catch the problem or not, or the docs should explain why there cannot be safety checking for this particular kind of undefined behavior.

With this it will be obvious how close (or distant) zig is from a safe language.

@Mouvedia
Copy link

@Mouvedia Mouvedia commented Aug 22, 2020

Most undefined behavior that cannot be detected at compile-time can be detected at runtime.

So you are saying that we need to add a no-safety sub section in https://ziglang.org/documentation/master/#Undefined-Behavior that will be continuously populated?
Do you have examples of such cases? e.g. from existing github issues

@hiroakitakada
Copy link

@hiroakitakada hiroakitakada commented Aug 22, 2020

So you are saying that we need to add a no-safety sub section in https://ziglang.org/documentation/master/#Undefined-Behavior that will be continuously populated?

I believe that the subsection listing all no-safety behavior should be added.

Do you have examples of such cases? e.g. from existing github issues

#3180 is already mentioned above. Other examples are unsafe language constructs and builtin functions including (but, not limited to) the followings.

  • undefined
  • [*]T
  • [*c]T
  • @bitCast
  • @intToPtr
  • @ptrCast
  • @memcpy
  • @memset
  • @fieldParentPtr

@andrewrk andrewrk removed this from the 0.7.0 milestone Oct 9, 2020
@andrewrk andrewrk added this to the 0.8.0 milestone Oct 9, 2020
@andrewrk andrewrk removed this from the 0.8.0 milestone Jun 4, 2021
@andrewrk andrewrk added this to the 0.9.0 milestone Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Safety
  
To do
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants