4 ms·
Probably, if you use memcpy and store the size of the data type as an extra parameter in the containing struct.
by AlexeyBrin 10y ago
Probably, if you use memcpy and store the size of the data type as an extra parameter in the containing struct.
- inlined 10y agoI was thinking about that but I don't know what to do with the type of the param you're accepting. Could you do a const void* ref? Might just be easier to make it variadic.
- AlexeyBrin 10y agoSee this comment https://news.ycombinator.com/item?id=13346432 https://news.ycombinator.com/item?id=13346432 . At this point creating a function like: array_push_back(int nr_arguments, ...); that will replace the original macro ~~should be possible~~. Actually it won't work without using non-standard compiler extensions like typeof.