Re:Why should I have written ZeroMQ in C, not C++ (part II)
by mangamadaiyan on Thursday August 30, 2012 @01:18PM
(#4455662)
Hrm. Check out sys/queue.h in any BSD (Linux too - though Linux kernel code IIRC uses a different list implementation). You don't necessarily need void * for a generic list, and you most certainly don't have to reinvent the wheel.
Re:Why should I have written ZeroMQ in C, not C++ (part II)
by YZF on Thursday August 30, 2012 @01:37PM
(#4455753)
queue.h is an improvement. You still need to somehow know this is in BSD and you'll need to copy it to build on different systems.
The thing is that in C, most people do reinvent the wheel, including the person in the original article and as you say, the Linux kernel. That's been my experience.
std::list is standard and cleaner IMO.
Most large C projects I've seen end up with multiple implementations of lists. You will have some combination of: void* for a generic list, performance issues because everything is a function call to another C file which won't get inlined, memory leaks, subtle bugs, thread safety issues because it's often unclear what guarantees the homebrew version provides.
Do you want to spend your time on reinventing the list or on things that provide value?
(Edited for formatting)