On Sat, Jul 23, 2016 at 9:03 PM T L <tapir....@gmail.com> wrote: > If "bytes" is a local variable, it is reasonable the compiler will do the optimization. > But how about if "bytes" is a global variable?
Not sure what a global variable is. Go has universe scope, but user code cannot declare variables in that scope. Assuming a package scope is meant instead: such optimization might be possible Iff the compiler is able to prove that no one is ever mutating the slice. -- -j -- 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.