Skip to content

Instantly share code, notes, and snippets.

@romanitalian
Created February 13, 2021 14:20
Show Gist options
  • Save romanitalian/60a3a245178f95e5d9588c9856c5c51b to your computer and use it in GitHub Desktop.
Save romanitalian/60a3a245178f95e5d9588c9856c5c51b to your computer and use it in GitHub Desktop.
type Foo struct {
aaa [2]bool
bbb int32
ccc [2]bool
}
type Bar struct {
aaa [2]bool
ccc [2]bool
bbb int64
}
fmt.Printf("required alignment: %+v\n", unsafe.Alignof(Foo{})) // required alignment: 4
fmt.Printf("required alignment: %+v\n", unsafe.Alignof(Bar{})) // required alignment: 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment