OSCON 2012 notes

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Sun Jul 22 11:46:38 PDT 2012


On Sun, 22 Jul 2012 18:14:23 +0200
Paulo Pinto <pjmlp at progtools.org> wrote:
> 	y := &x[0]
> 	fmt.Println("Base adress ", y)
> 	size := unsafe.Sizeof(x[0])
> 	fmt.Println("Size per element ", size)
> 	for i := 0; i < len(x); i++ {
> 		cell := uint64(uintptr(unsafe.Pointer(y))) +
> (uint64(i) * uint64(size)) value :=
> (*byte)(unsafe.Pointer(uintptr(cell))) fmt.Printf("%d index is %d, at
> %p\n", i, *value, value) }
> }
> 

Eeew!! That's awful.



More information about the Digitalmars-d mailing list