Created
January 28, 2022 17:40
-
-
Save Miezhiko/3594f02e178a80266baf6049c6cb2ba5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn f() { | |
let mut c: i64 = 1; | |
let d: i64 = 2; | |
let mut x: i64 = 3; | |
unsafe { | |
*(&mut x as *mut i64).sub(2) = 42; | |
} | |
println!("{c:?} {d:?} {x:?}"); | |
unsafe { | |
*(&mut c as *mut i64).add(2) = 24; | |
} | |
println!("{c:?} {d:?} {x:?}"); | |
} | |
fn main() { | |
f(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment