2 comments

[ 0.99 ms ] story [ 16.0 ms ] thread
> Truly generic in C: type erasure via elem_size — no macros, no code generation, no void* arithmetic in user code.

Did an LLM write this?

Ok, real talk. The implementation is very basic but it's fine, there isn't anything that's very wrong about it at a cursory glance. The choice of having "method style" calls as function pointers is extremely baffling though: you still have to pass a pointer to the vector explicitly (it's C, you have no automatic this), and you are allocating a pointer on the stack for each of the methods of this "class" as though they were virtual methods. What do we gain from this?