Hi, 

I have a question about runtime.Pinner: The documentation states that you 
can only pin an object when it’s the result of calling new, taking the 
address of a composite literal, or taking the address of a local variable.

At the same time, the Go language specification states that a slice created 
with make allocates a hidden array, and gives the example that make([]int, 
50, 100) is the same as new([100]int)[0:50].

Taken together, this suggests that the following sequence should be correct:

var p runtime.Pinner
s := make([]int, 100)
p.Pin(&s[0])

…since &s[0] can be understood as being the result of calling new.

Is that intended?

Also: I believe it would be good if the documentation would state that the 
zero value for type runtime.Pinner is ready to use.


Thanks,
Pascal

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e9326379-5eaa-4051-89de-466f3c6302e1n%40googlegroups.com.

Reply via email to