Standard library / go/types
go/types.StdSizes
Simplified word-size and alignment model, not necessarily the exact compiler layout. Expected stdout: '4 12\n'.
Formal Syntax & Structure
go syntaxgo
type StdSizes struct { WordSize int64 MaxAlign int64}Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { s := types.StdSizes{WordSize: 4, MaxAlign: 4} fmt.Println(s.Sizeof(types.Typ[types.Int]), s.Sizeof(types.NewSlice(types.Typ[types.Int])))}