]> Cypherpunks.ru repositories - gostls13.git/blob - test/sizeof.go
test/[n-z]*.go: add documentation
[gostls13.git] / test / sizeof.go
1 // compile
2
3 // Copyright 2011 The Go Authors.  All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Test unsafe.Sizeof, unsafe.Alignof, and unsafe.Offsetof all return uintptr.
8
9 package main
10
11 import "unsafe"
12
13 type T struct {
14         X int
15 }
16
17 var t T
18
19 func isUintptr(uintptr) {}
20
21 func main() {
22         isUintptr(unsafe.Sizeof(t))
23         isUintptr(unsafe.Alignof(t))
24         isUintptr(unsafe.Offsetof(t.X))
25 }