We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Weak pointers are now only allowed for heap-allocated data:
fn f() { a := 42 wp := weak ^int(&a) if p := ^int(wp); p != null { printf(repr(p^) + '\n') } else { printf("NULL\n") } } fn g() { q := new(int, 42) wp := weak ^int(q) if p := ^int(wp); p != null { printf(repr(p^) + '\n') } else { printf("NULL\n") } } fn main() { f() // NULL g() // 42 }
From the language specification:
If the weak pointer does not point to a valid dynamically allocated memory block, the result of this conversion is null.
null
Related issue: #274
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Weak pointers are now only allowed for heap-allocated data:
From the language specification:
Related issue: #274
The text was updated successfully, but these errors were encountered: