3 ms·
Then you have the new problem of restricting its growth and that adds a new failure mode to deal with. The C idiom works fine if you don't have implementation b
by kevin_thibedeau 4y ago
Then you have the new problem of restricting its growth and that adds a new failure mode to deal with. The C idiom works fine if you don't have implementation bugs.
- tptacek 4y agoEverything has that failure mode, in every language.
- kevin_thibedeau 4y agoWriting into a zero length output buffer does not fail and consumes no memory resources.
- tedunangst 4y agoWho cares? You still have to write the code that handles failure when the buffer length isn't zero.
- Sankozi 4y agoNull terminated string is probably the worst data structure that was invented. It is has caused numerous security problems. It takes worst performance characteristics from array and linked lists (slow resizing, slow indexing). It definitely does not work fine.
- Joker_vD 4y agoResizing arrays is such an annoying problem... because memory address space is flat. If only we had some sort of resizeable, non-overlapping by design segments, kind of like we have virtual memory mappings... but that'd completely kill address arithmetic. Oh well.