On Mon, Sep 19, 2016 at 2:35 PM,  <badrel...@gmail.com> wrote:
> I don't like the extra allocation and copies involved when casting from byte
> slice to string or vice versa just because one type or the other is
> required. The code below reuses the data pointer and as far as I can tell in
> my tests so far, it even works well with garbage collection. My question
> is... why shouldn't I do this?

1) There is no promise that this will work in future versions of Go.

2) If something changes the []byte, weird things will happen, and the
race detector won't notice.

Ian

-- 
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.

Reply via email to