1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/volatile_vars_test.v

15 lines
226 B
V

fn test_volatile_var() {
mut volatile zzz := 123
assert zzz == 123
}
fn test_volatile_pointer() {
x := 123
y := 456
mut volatile p := unsafe { &x }
println(p)
p = unsafe { &y }
println(p)
assert unsafe { *p == y }
}