TL,

Radically different parameters:

func Intn(n int <https://golang.org/pkg/builtin/#int>) int 
<https://golang.org/pkg/builtin/#int>

func Println(a ...interface{}) (n int <https://golang.org/pkg/builtin/#int>, 
err error <https://golang.org/pkg/builtin/#error>)

Peter

On Wednesday, August 31, 2016 at 11:06:24 AM UTC-4, T L wrote:
>
>
> Why does the parameter passed to fmt.Print escape to heap?
>
>
> // 11.go
> package main
> import "fmt"
> import "math/rand"
>
> func f1(v int) {
>     fmt.Print(v) // v escapes to heap
> }
>
> var a int
> func f2(v int) {
>     a = rand.Intn(v) // v doesn't escape
> }
>
> func main() {
> }
>
> /*
> > go build -gcflags=-m 11.go
> # command-line-arguments
> ./11.go:15: can inline main
> ./11.go:7: v escapes to heap
> ./11.go:7: f1 ... argument does not escape
> */
>
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to