2 ms·
Since you don't need to care about the 'outer type' in that case you just pass a pointer to the linked list header or a linked list node and that's it. If you
by flohofwoe 2y ago
Since you don't need to care about the 'outer type' in that case you just pass a pointer to the linked list header or a linked list node and that's it.
If you need to access the outer type, just pass a pointer to that type (since your functions need to know the outer type anyway I don't think there's a need to reach for generics).
- skywal_l 2y agoYou have to pass the field name too ("node").
- flohofwoe 2y agoNot really. If you only want to manipulate the list, you only need a direct pointer to the nested node but don't need to know the 'outer type'. Only if the function takes a pointer to the outer type it needs to know how to get the pointer to the embedded node struct from the item pointer. ...I guess it makes a lot more sense if you ever wrote code for AmigaOS ;)