Skip to main content
9 events
when toggle format what by license comment
Jan 12, 2012 at 18:11 comment added c0da @kizzx2 Yep... "If we go farther than that we're basically tasked to implement strong typing on top of a weakly typed language". Very well said my friend. And yes, the list is general, if not generic. And it may not be heterogeneous at all.
Jan 12, 2012 at 14:13 comment added kizzx2 @c0da The "general" C linked list largely deviates from definitions of what most people mean by "generic" linked list -- it is simply a specific linked list for void *. Semantically, it is also quite different from most linked list because it is heterogeneous by nature and cannot be safely passed around without the user having to check every element's type in paranoia. If we go farther than that we're basically tasked to implement strong typing on top of a weakly typed language.
Jan 12, 2012 at 12:42 comment added c0da @poke Hmmm... Maybe general is the correect word to be used here... But even in such linked lists in C, the user can specify the size of data in bytes, and the same thing can be used all along...
Jan 12, 2012 at 9:53 comment added poke @c0da In my opinion, a list that uses void pointers are not generic, but just general for any time. They can hold any type of things in it, and even mix them all they want – and exactly that makes it non-generic for me. It’s like using the base type object in object oriented languages…
Jan 11, 2012 at 18:32 comment added Steven Evers Even writing a generic linked list in C# has one or two "gotchas" (e.g. comparing elements of type T is non-obvious; ie. (T v1, T v2) => { return v1 == v2; } will fail to compile unless you have class constraints or use the default equality operator)
Jan 11, 2012 at 17:58 comment added c0da I haven't tested these codes, but I have this type of linked list earlier, and it sure worked fine...
Jan 11, 2012 at 17:56 comment added c0da Seriously? I thought void pointers are there for that only... :) The first link I found on google for "generic linked list in c" was: daniweb.com/software-development/c/threads/109260 and another one was technical-interview.com/… I thought everyone knew this!
Jan 11, 2012 at 17:53 comment added DeadMG No such thing as a generic linked list in C.
Jan 11, 2012 at 17:45 history answered c0da CC BY-SA 3.0