I have a array of somestruct_t I'm adding to but don't know in advance how many elements it will need. So I malloc 5 slots of space to start with but I need to encapsulate it in another struct that saves the array boundary and whats used so far so I don't overflow. I'll realloc if it looks like it will overflow.
typedef struct {
somestruct_t[] *data;
uint32_t max_size;
uint32_t used;
} something_box_t;
Is this the idiomatic way to do this?
std::vector, assuming you didn't tag the question with both C and C++, but only wanted C.somestruct_tobjects that will be in asomething_box_t? How large are thesesomestruct_tobjects?