Thanks to both of you. On Sat, Feb 27, 2021 at 06:56:04PM -0800, Ian Lance Taylor wrote: > Although rule 4 in the documentation of the unsafe package mentions > syscall.Syscall, the implementation isn't restricted to the syscall > package. It applies to any function that is written in assembly: that > is, a function that is declared in Go without a body. > We should perhaps tweak the docs to make that the rule.
I see, I was assuming that the assembly function of syscall.Syscall does some (even darker) dark magic than normal assembly to guarantee that. So a doc update would indeed be helpful. > Now that you point this out, I'm actually not sure that this is OK. I > don't know what keeps v pinned during this call. > >> IoctlSetPointerInt clearly converts a unsafe.Pointer to a uintptr and > >> *doesn't* > >> directly call syscall.Syscall. > >> > >> Why is this valid? > I'm not sure it is. Hm, do you want me to open up a bug on GitHub? The reason I originally asked is that I have a third party module that does just the same and while writing the patch to actually adhere to the unsafe constraints, I started reading the stdlib and it's kinda hard to argue for a patch upstream if the go stdlib uses the exact same pattern ;) Greetings, Reto -- 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/20210228090612.xfjvyv35qvyukruk%40feather.localdomain.