Created
January 13, 2019 14:21
-
-
Save ashkrit/05662eedff3173650654c1df25870f97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x layouttest | |
var y compactyouttest | |
fmt.Printf("Int alignment %v \n", unsafe.Alignof(10)) | |
fmt.Printf("Int8 aligment %v \n", unsafe.Alignof(int8(10))) | |
fmt.Printf("Int16 aligment %v \n", unsafe.Alignof(int16(10))) | |
fmt.Printf("Layoutest aligment %v ans size is %v \n", unsafe.Alignof(x), unsafe.Sizeof(x)) | |
fmt.Printf("Compactlayouttest aligment %v and size is %v \n", unsafe.Alignof(y), unsafe.Sizeof(y)) | |
fmt.Printf("Type %v has %v fields and takes %v bytes \n", reflect.TypeOf(x).Name(), reflect.TypeOf(x).NumField(), reflect.TypeOf(x).Size()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment