19 ms·
Why is assigning a constant unsafe? struct App { mut: gg &gg.Context = unsafe { 0 } } https://github.com/vlang/v/blob/f0cee25213e25289ae4c
by kennywinker 4y ago
Why is assigning a constant unsafe?
struct App {
mut:
gg &gg.Context = unsafe { 0 }
}
https://github.com/vlang/v/blob/f0cee25213e25289ae4c60ba9a6a12e4aadf5e9d/examples/2048/2048.v#L10 https://github.com/vlang/v/blob/f0cee25213e25289ae4c60ba9a6a...
- amedvednikov 4y agoBecause it's null (unsafe{0} will be replaced with unsafe {nil}) It needs to be inited recursively with app := App { gg: &gg.Context { ... app } } And that doesn't work yet. It used to work in the initial V, but not right now. It'll be fixed in 0.4.