Hello everyone,
Code as below, playground url(https://play.golang.org/p/XSx--6uF0E): package main import "fmt" import "unsafe" type A struct { a uint8 b uint64 } func main() { a := &A{} fmt.Println(unsafe.Sizeof(a)) fmt.Println(unsafe.Sizeof(*a)) } When I run the code in go playground, I get what as i expected. 4 16 Program exited. but when I test the code in my own environment(linux i386 & win32, both), I get a unreasonable result as below: $ go version go version go1.8.1 linux/386 $ go run align.go 4 12 Then I test a similar code in C, the result is same as go playground. typedef struct _aaa { UINT8 a; UINT64 b; }AAA; printf("%d",sizeof(int*)); // 4 printf("%d",sizeof(AAA)); // 16 uint64 should aligin in 8 bytes, why it aligns in 4 bytes in go1.8.1.linux-386? Could anyone tell me how I can get the same result with go playground? Best regards, drew -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.