请看例子:http : //play.golang.org/p/6d4uX15EOQpackage mainimport ( "fmt" "reflect" "unsafe")func main() { c := "foofoofoofoofoofofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo" fmt.Printf("c: %T, %d\n", c, unsafe.Sizeof(c)) fmt.Printf("c: %T, %d\n", c, reflect.TypeOf(c).Size())}输出:c: string, 8 //8 bytes?!c: string, 8这么大的字符串好像不能有这么小的尺寸!怎么了?
目前暂无任何回答
- 0 回答
- 0 关注
- 215 浏览
添加回答
举报
0/150
提交
取消