3 ms·
just don't initialize it with 0 capacity :-)
by nice_byte 4y ago
just don't initialize it with 0 capacity :-)
- skullt 4y agoWhy not just fix it? It's a trivial fix and has the added benefit that a zero-initialized DYN_ARR_OF(x) struct would be in a valid state, which is always nice. A struct with several dynamic arrays can then much simpler to initialize, for example.
- acmj 4y agoFor a library, if the user input is wrong, throw an error or an assertion failure. It shouldn't be causing an uninformative segmentation fault which your library does. The fix is a trivial. Why so defensive?