Why the unsafe pointer reference?
Closed this issue · 2 comments
coolaj86 commented
Line 222 in 9b9fb35
Wouldn't this be the same as return string(bytes)
and return []byte(str)
?
jxskiss commented
This is a common unsafe trick, it avoids unnecessary memory allocation.
coolaj86 commented
Hmm... I didn't realize that sort of casting would reallocate. I always assumed it was Copy-on-Write.