2026-04-08 07:11 UTC
@alios
OTOH this can lead to "interesting" workarounds:
- preallocations of memory, reuse it in creative ways, e.g. like often seen in FORTRAN77 libraries
- preallocation of too much memory, just in case (e.g. text editor: how big and how structured will be your text buffer?)
Replies (1)
-
@chrysn@chaos.social 2026-04-08 10:38
@vampirdaddy @alios Also recursing on the stack for storage. But these are relatively few antipatterns to keep an eye out for. A pattern that avoids trouble from fixed size as well as preallocation is having (type-)generic pluggable back-end. Then there are two simple impls provided, one for alloc and one for a const generic fixed size.