Исходники и презентации
This commit is contained in:
15
lessons/structs/check_struct_size/main.go
Normal file
15
lessons/structs/check_struct_size/main.go
Normal file
@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
import "unsafe"
|
||||
|
||||
type Data struct {
|
||||
id int32
|
||||
data [60]byte
|
||||
}
|
||||
|
||||
// Describe:
|
||||
// - Alignof
|
||||
// - Offsetof
|
||||
|
||||
var _ uintptr = unsafe.Sizeof(Data{}) - 64
|
||||
var _ uintptr = 64 - unsafe.Sizeof(Data{})
|
||||
Reference in New Issue
Block a user