On Wed, Apr 3, 2019 at 11:50 PM wrote:
>
> hehe, thanks, so if i want understand deeply, need to look up gc code?
No, the language spec is at https://golang.org/ref/spec.
Ian
> 在 2019年4月3日星期三 UTC+8下午10:34:57,Ian Lance Taylor写道:
>>
>> On Wed, Apr 3, 2019 at 6:32 AM wrote:
>> >
>> > thanks! v mu
On Thursday, 4 April 2019 08:49:48 UTC+2, mount...@gmail.com wrote:
>
> hehe, thanks, so if i want understand deeply, need to look up gc code?
>
No, that is not necessary for basics like this question here.
The compiler implements the language spec and the spec describes
how the language works and
hehe, thanks, so if i want understand deeply, need to look up gc code?
在 2019年4月3日星期三 UTC+8下午10:34:57,Ian Lance Taylor写道:
>
> On Wed, Apr 3, 2019 at 6:32 AM > wrote:
> >
> > thanks! v must be a value copy,Is this determined by the compiler?
>
> It's determined by the language definition.
>
> I
On Wed, Apr 3, 2019 at 6:32 AM wrote:
>
> thanks! v must be a value copy,Is this determined by the compiler?
It's determined by the language definition.
Ian
> 在 2019年4月3日星期三 UTC+8下午7:57:26,Marvin Renich写道:
>>
>> * mount...@gmail.com [190403 05:10]:
>> > package main
>> >
>> > func main() {
>>
thanks! v must be a value copy,Is this determined by the compiler?
在 2019年4月3日星期三 UTC+8下午7:57:26,Marvin Renich写道:
>
> * mount...@gmail.com >
> [190403 05:10]:
> > package main
> >
> > func main() {
> > b := []int{1}
> >
> > bb := make([]*int, 0, 1)
> > for k, v := range b {
>
> The abo
* mountain...@gmail.com [190403 05:10]:
> package main
>
> func main() {
> b := []int{1}
>
> bb := make([]*int, 0, 1)
> for k, v := range b {
The above range clause will assign to k the index of the current
element, and it will assign to v a copy (as if v = b[k]) of the element
at that index.
package main
func main() {
b := []int{1}
bb := make([]*int, 0, 1)
for k, v := range b {
_ = &v //8 line
_ = &b[k] //9 line
// bb = append(bb, &v)
bb = append(bb, &b[k])
}
// for _, v := range bb {
// fmt.Println(*v)
// }
}
1、When i use `go too compile -N -l -S main.go |grep "main.go:8" ` print