1 package main
 2        
 3 import (
 4     "fmt"
 5     "unsafe"
 6 )   
 7        
 8 func main() {
 9     fmt.Printf("%d\n", unsafe.Sizeof(struct {
10         a  byte                                                                                                                                       
11         i8 int 
12         b  byte
13     }{}))
14 }   
 1 package main
 2             
 3 import ( 
 4     "fmt"
 5     "unsafe"
 6 )           
 7             
 8 func main() {
 9     fmt.Printf("%d\n", unsafe.Sizeof(struct {
10         i8 int 
11         a  byte                                                                                                                                       
12         b  byte
13     }{}))
14 }
  • 结果:16