-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
compile-time use of undefined value detection #597
Comments
After |
No, you would need to make |
It's not the same as deleting a variable then. I want it to stop existing, completely. I will only ever delete variables that are temporary anyway. Probably a wrong place to talk about it, should've I wrote this in the closed issue? |
You are asking for feature similar to "hyperstatic scope" used in Forths ( http://wiki.c2.com/?HyperStaticGlobalEnvironment ). Here it is used for functions (Forth doesn't have anything else) and allows to reuse their names, reducing the need to invent unique names all the time. It is one of Forth's strong points. |
That's too smart for me. I'm just trying to steal the |
LLVM does this automatically, it is called "stack slot coloring". |
@PavelVozenilek I know, but didn't knew it's called "stack slot coloring". Just wanted to say that it's possible for compiled languages too, and not for interpreted ones only. It's more of a hint for a programmer that this variable will not be used again, and also a safety net. More details here #594, further discussion should be there I guess. |
Related: #1947 |
Zig should be able to detect that we will with 100% certainty branch on an undefined value.
Related:
Should be an error, because it's 100% certain at compile-time that we will reach unreachable code.
Not to be confused with #211 which is adding extra code and data in safety-enabled builds to detect use of undefined value at runtime.
The text was updated successfully, but these errors were encountered: