Hello Gophers! As you probably noticed by my question, I'm new to this awesome language called Go (coming from C/C++). In C++ I rely a lot on constructor (copy) elision. I think Go doesn't have this concept, but I would like to know what happen when I do something like this:
func NewStuff() Stuff { return Sutff{} } What will happen in that case? Will it be store on the stack, and then copied to the caller function? That will probably be inlined, so: func NewStuff() Stuff { // A lot of pre-processing that won't be inlined. return Sutff{ Value: var1, Another: var2, Etc: var3, } } The returned value will be copied, or the compiler will optimize and change the memory space of the caller function? Thank you! -- 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.