| // We are going to define 256 types T(n), |
| // such that T(n) embeds T(2n) and *T(2n+1). |
| fmt.Printf("// errorcheck\n\n") |
| fmt.Printf("package p\n\n") |
| fmt.Println(`import "unsafe"`) |
| for n := 1; n < 256; n++ { |
| for n := 256; n < 512; n++ { |
| fmt.Printf("type T%d int\n", n) |
| fmt.Printf("var p *T1\n") |
| for n := 2; n < 256; n++ { |
| for n := 128; n < 256; n++ { |
| for n := 128; n < 256; n++ { |
| func writeStruct(n int) { |
| fmt.Printf(structTpl, n, n, 2*n, 2*n+1) |
| func writeDot(ns ...int) { |
| for _, root := range []string{"t", "p"} { |
| fmt.Printf("const _ = unsafe.Offsetof(%s", root) |
| // Does it involve an indirection? |
| for n := nlast / 2; n > nprev; n /= 2 { |
| fmt.Print(` // ERROR "indirection"`) |