On Fri, Mar 1, 2019 at 6:37 AM Cholerae Hu wrote:
> Will 'a' be scanned by go runtime?
Yes.
> It is allocate by go runtime.
Correct and that's the reason the GC will handle it normally.
> If p is scanned, go runtime should throw a 'bad pointer' error, because
the memory pointed by p is alloca
Consider the following code:
```
package main
/*
struct B {
int i;
};
struct A {
int j;
struct B b;
};
*/
import "C"
func NewA() *C.struct_A {
return &C.struct_A{
j: 1,
b: C.struct_B{
i: 2,
},
}
}
func main() {
a := NewA()
}
```
Will 'a' be scanned by go runtime? I