they both have the same size, eg. following structs bar and bar2 both take
16 bytes memory on a x64 machine.
package main
import (
"fmt"
"unsafe"
)
type bar struct {
A int
_ bool
}
type bar2 struct {
A int
_ [0]byte
}
func main() {
bar := bar{}
bar2 := bar2{}
if a method only defined for a pointer receiver, the compiler will add "*"
before the caller silently.
Why pointer receiver? Try to change the value of a member. You will know
the difference.
On Sunday, May 7, 2017 at 6:37:59 PM UTC+8, mhh...@gmail.com wrote:
>
> yes, sorry you scratched your h