V version:
OS: win10
What did you do?
struct Mo {mut: x int}
fn main() {
mut w:=Mo{1}
println(&w) //this doesn't work
println(&(w.x)) //this work
}
What did you expect to see?
the address of w
What did you see instead?
the second example shows you the address of x. but it shouldn't. We won't print addresses. the first println is correct but a missing & in front.
Hi
I don't understand.
The second println OK, because it print the address of w.x
The first one doesn't print the adress of w.
it should never print the address imo
I know
I think it should print : &{1} //in Go it is the result
but in V : Mo{ x:1 }
Is it OK ?
Why should V not print addresses? That makes cave man debugging much harder.
@medvednikov should decide
Why should V not print addresses? That makes cave man debugging much harder.
You can print voidptr addresses:
println(voidptr(&w)) // 13fe8c
OK. Thank you Sir.
Why should V not print addresses? That makes cave man debugging much harder.
You can print
voidptraddresses:println(voidptr(&w)) // 13fe8c
will this be the official way to print addresses?
There is a builtin ptr_str function, that (afaik) does the same thing but is more explicit:
println(ptr_str(&w)) // 7ffee5210888
Most helpful comment
You can print
voidptraddresses: