Hi Chris:
I am gopher from Beijing China . I am very like programing and adore
the old hack culture . and NBA too!
I am very happy in google groups and receive the answer so quickly.
go on practice programing and improve my badly english
You're correct. I'm sorry about my first response; it was too brief and led
to the confusion you have. The Go escape analysis algorithm has a concept
of "loopdepth" (shortened as ld in debug output). The loopdepth is -1 for
global variables, 0 for input arguments to a function, 1 for the top level
The only real rule is "when the compiler can prove, that it doesn't escape,
it doesn't". There is no guarantee or fixed policy around escape analysis.
If you are convinced that something doesn't escape and that the compiler
should be able to figure it out, you can try filing an issue about that
package main
func main() {
var m map[int]int
{
m = make(map[int]int)
}
_ = m
}
if I do this m will not escape just want to know what's the scope rule for
escape ? puzzled
-gcflags=-m is your guide. There are no documents of the escape analysis done
by the gc compiler, but you could read the source of
cmd/compile/internal/gc/esc.go
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group
veyr thanks and want to know more about go's compile and escape rules
在 2016年9月29日星期四 UTC+8上午1:39:09,Chris Manghane写道:
>
> In the first example, make does not escape the scope of the for statement.
> In the second example, make is assigned to m, which is outside of the scope
> of the for
On Wed, Sep 28, 2016 at 11:15 AM, ⚛ <0xe2.0x9a.0...@gmail.com> wrote:
> We could discuss what has "gone wrong" in the Go compiler; and how to make
> it work at least in theory.
>
> Unfortunately, me not being paid by Google is a line I am both unable and
> unwilling to cross.
>
> I feel sorry for
We could discuss what has "gone wrong" in the Go compiler; and how to make
it work at least in theory.
Unfortunately, me not being paid by Google is a line I am both unable and
unwilling to cross.
I feel sorry for not being able to discuss the subject of escape analysis
which by itself is
go 1.7
在 2016年9月28日星期三 UTC+8下午10:41:09,Dave Cheney写道:
>
> Which version of Go?
>
> On Thursday, 29 September 2016 00:18:29 UTC+10, 刘桂祥 wrote:
>>
>> // example1.go
>> package main
>>
>>
>> func main() {
>>
>> for i := 0; i < 2; i++ {
>> m := make(map[int]int)
Which version of Go?
On Thursday, 29 September 2016 00:18:29 UTC+10, 刘桂祥 wrote:
>
> // example1.go
> package main
>
>
> func main() {
>
> for i := 0; i < 2; i++ {
> m := make(map[int]int)
>
10 matches
Mail list logo