10 points · by AncoraImparo · 13y ago · 38 comments
Thanks.
I prefer to store next/prev pointers with the data itself, and to use offsetof/containerof to find a pointer to the data struct which contains a given set of next/prev pointers.
One example of such an scheme is the list used in the Linux kernel:
You are, for whatever it's worth, better off defaulting to a variable-length array than to a linked list.
really tptacek? its O(1) ammortized over time, and when N grows it becomes really slow because it involves reallocation and a linear copy of all elements.
1. Please align the asterisks properly. It hurts eyes.
2. Access by index?
3. Iterator (callback on each element)
4. use 'init' instead of 'initialize'. Extra typing hurts fingers.