Skip to content

Instantly share code, notes, and snippets.

@kevin-cantwell
Last active June 17, 2016 16:51
Show Gist options
  • Select an option

  • Save kevin-cantwell/86e6ee62f2063dae59530d391a1d8669 to your computer and use it in GitHub Desktop.

Select an option

Save kevin-cantwell/86e6ee62f2063dae59530d391a1d8669 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"unsafe"
)
func main() {
type Foo struct {
a int32
b int32
c int32
d int32
}
var foo *Foo
var bar *int32
fmt.Println(unsafe.Sizeof(foo)) // prints 8 on 64-bit architectures, 4 on 32-bit
fmt.Println(unsafe.Sizeof(bar)) // prints 8 on 64-bit architectures, 4 on 32-bit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment