> > https://research.swtch.com/godata > I did read it, but what I was asking is irrelevent to it.
func showInt(x int) { res := (*[unsafe.Sizeof(x)]byte)(unsafe.Pointer(&x)) for i := range res { fmt.Printf("%.2x ", res[i]) } fmt.Println() } // showInt(12345) // 39 30 00 00 00 00 00 00 An integer in it's binary form is stored like above, little endian. What I mean is how, strings are represented, while converting a string to []byte, gives me utf-8 values, but directly ascessing the underlying memory of string, without converting it to []byte shows different things. > > Because in Go the size of an array must be a constant. > > > > Ian > An array size must be constant, but my real question is? How come, a uintptr type value returned by unsafe.Sizeof(x), is considered as const? and doesn't accept, if uintptr type value is returned by someother function. I mean, how was it able to differentiate between someother function and unsafe.Sizeof(x). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.