3 ms·
> C completely lacks such facility. Generic linked lists can be done with pointer casts. See the way the Linux kernel does it. The list manipulation routine t
by asveikau 4y ago
> C completely lacks such facility.
Generic linked lists can be done with pointer casts. See the way the Linux kernel does it.
The list manipulation routine takes a pointer to a member, and the more specific type is opaque. The code that knows what the actual structure is can derive it from a node pointer.
A structure can even have multiple node pointers in this scheme.