News for hackers. Stuff that matters.
Re:IBM to buy HashiCorp in $6.4B deal by geoka9 on Wednesday April 24, 2024 @07:48PM (#40151400)
It's because slices have underlying arrays which define their capacity (cap(s)).

Both slices start out having the same underlying (bigger) array -so appending to one slice can affect the other one.

In the "bonus" part, though, the appends outgrew the original array, so new underlying arrays were allocated (i.e. the slices stopped sharing the same backing array).

Thanks for the heads-up, janosdebugs :)

There are no comments on this comment yet.