Исходники и презентации
This commit is contained in:
19
lessons/structs/alignment_functions/main.go
Normal file
19
lessons/structs/alignment_functions/main.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type data struct {
|
||||
aaa bool
|
||||
bbb int32
|
||||
ccc bool
|
||||
}
|
||||
|
||||
func main() {
|
||||
d := data{}
|
||||
fmt.Println(unsafe.Offsetof(d.ccc))
|
||||
|
||||
fmt.Println(unsafe.Alignof(d))
|
||||
}
|
||||
Reference in New Issue
Block a user