vec
vec copied to clipboard
A type-safe dynamic array implementation for C
Added functionality for users to define `VEC_FREE` and `VEC_REALLOC` prior to including the `vec.h` header to have the library use those for memory allocation and freeing instead of the standard...
I am unsure if this project is still actively maintained, though I thought I would create the issue as it is still used in code today. I wanted to propose...
Discussion about the details of the issue can be found here: https://stackoverflow.com/questions/60643222/how-to-solve-right-hand-operand-has-no-effect-error
A multiplication result that is converted to a larger type can be a sign that the result can overflow the type converted from. Use a cast to ensure that the...
Hi, when I use vec_insert(), I meet the problem of "right-hand operand of comma expression has no effect" again, even if I have revised vec.h in the way mentioned in...
Hi. Thanks for sharing your project! I get the following error while compiling with the `xtensa-esp32-elf` tool chain for the Espressif ESP32 platform: ``` #define vec_push(v, val)\ ( vec_expand_(vec_unpack_(v)) ?...
This causes behavior which the user might not expect and results in segfaults: ```c int i = 0; vec_insert(&my_vec, i++, my_value); // i = 2 ```
Since both of these functions are implemented as do-while macros (through `vec_pusharr`), there's no way of knowing if the reallocs in them succeeded or not, which is bad. Returning a...
``` c #define vec_unpack_(v)\ (char**)&(v)->data, &(v)->length, &(v)->capacity, sizeof(*(v)->data) ``` Strictly speaking, `(char**)&(v)->data` is only correctly defined when `data` actually is a char-pointer, elsewise dereferencing this pointer in your functions causes...