Re:Generic dynamic array in 60 lines of C
by marginalia_nu on Tuesday February 28, 2023 @03:41PM
(#34974537)
Is this overflow really a realistic scenario? I imagine most machines won't even permit you to allocate the sorts of sizes that would cause this bug.
[ Parent
| on HN ]
Re:Generic dynamic array in 60 lines of C
by klyrs on Tuesday February 28, 2023 @04:12PM
(#34974926)
2Gb (1<<31 + 1 = boom) just isn't that much memory these days. If you're parsing large text files, for example, it's really easy to blow that limit. And what's the point of this dynamically-growing array if not to forget about managing capacity?