On Saturday, May 19, 2018 at 10:42:12 PM UTC+2, Max wrote:
>
>
> func mallocList() *List {
> const n = unsafe.Sizeof(List{})
> p := C.malloc(C.ulong(n))
> C.memset(p, C.int(n), 0)
> return (*List)(p)
> }
>
I swapped the arguments to C.memset(). The correct version is:
func mallocList() *List {
const n = C.ulong(unsafe.Sizeof(List{}))
p := C.malloc(n)
C.memset(p, 0, n)
return (*List)(p)
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.