aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKarl Zylinski <karl@zylinski.se>2024-06-29 08:23:39 +0200
committerKarl Zylinski <karl@zylinski.se>2024-06-29 08:57:21 +0200
commit679f9b4e413fb1cd9aad953cc7a7a287f5abf226 (patch)
treee96ec7d669312c1d9a280e9a8d35b983562daabb /src
parent06652bebce111640930a513c825e59f7b37bbd4f (diff)
Made default capacity of dynamic arrays more consistent.
Before this if you do `arr: [dynamic]int` and then append to arr, then it will have capacity 8. But if you did `arr := make([dynamic]int, context.temp_allocator)` then arr would have capacity 16. Now both `arr: [dynamic]int` and `arr := make([dynamic]int, context.temp_allocator)` will resut in arr having zero 0. The only reason to use `make` without an explicit len or cap now is because you want to set it up for a non-default allocator. After the first call to `append` it will now in both cases have capacity 8. I also updated the documentation on the strings builder, both to reflect this, and also to fix it incorrectly saying that len would be 'max(16,len)', which wasn't true even before these changes.
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions