2021-11-21から1日間の記事一覧
TL;DR 0をuintptrにキャストして使用する unsafe.Sizeof(uintptr(0)) mallocに渡す ptr := (**C.char)(C.malloc(C.size_t(unsafe.Sizeof(uintptr(0))))) モチベーション cgoでコードを書いていて、ポインターのサイズ分、マロックしたい。 公式 cgoによると…
TL;DR 0をuintptrにキャストして使用する unsafe.Sizeof(uintptr(0)) mallocに渡す ptr := (**C.char)(C.malloc(C.size_t(unsafe.Sizeof(uintptr(0))))) モチベーション cgoでコードを書いていて、ポインターのサイズ分、マロックしたい。 公式 cgoによると…