and i want to got the code where go build check slice's cap to decide where use growslice?
在 2019年4月11日星期四 UTC+8下午6:19:30,jianfeng ye写道: > > Some article tell me when slice use append function, if slice's cap > is satisfy,it will not grow slice。 > > but I want to know when golang know the slice's cap is satisfy? > > so, i write a code like this: > > [image: 1111111.jpeg] > and compile it, got > > > [image: 222222.png] > > > then, i write another code: > > [image: 3333333.png] > > complie: > > [image: 44444444.png] > > > i found two code just different in slice's cap,but the compile result is > different, one call growslice, one does not. > > > so does it mean the go compiler will check slice's cap to check whether it > need use growslice? > > > > > > > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
