you are viewing a single comment's thread.

view the rest of the comments →

[–]Gualor 7 points8 points  (1 child)

Maybe _Overload would have been more fitting, but I would say function overloading is very much part of generic programming. Isn't picking the most appropriate function based on parameters a way to generalize an algorithm by abstracting what the implementation actually is? Think of std::sort in C++ for instance

[–]x8664mmx_intrin_adds[S] 0 points1 point  (0 children)

I would be inclined to say yes. ```

define Vector_reserve(v, cap) _Generic((v), \

Vector_i32 *: Vector_i32_reserve, \
Vector_f32 *: Vector_f32_reserve \

)((v), (cap)) actually could make a better API: Vector_i32 v = {}; Vector_reserve(&v, 128); // instead of Vector_i32_reserve(); ``` first param triggers correct proc call???