Hello,

Running `go build -gcflags -m` on the given code below will produce:


   main.go:3: can inline f1

   main.go:24: inlining call to f1


Can someone please explain why doesn't the f2 function get inlined ?

Thanks



package main

func f1() int {

       i := 0

loop:

       if i > 10 {

               return i

       }

       i++

       goto loop

}

func f2() int {

       i := 0

       for {

               if i > 10 {

                       return i

               }

               i++

       }

}


func main() {

       f1()

       f2()

}


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