Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It took me about a minute to find an instance of list linking in Java sources (OpenJDK):

  class JVMCIRuntime: public CHeapObj<mtJVMCI> {
    ../
    JVMCIRuntime* _next;
The Linux kernel has list linking all over the place. Userland libraries and utilities ditto.

I don't think I've ever worked on a C++ or C project that had no linked lists anywhere. I'm trying to think of an example but coming up blank.

Quite often but not always linked lists in C are intrusive. Certain object are going to be put into exactly one list. Or more than my list but only one at a time. So the link pointer or pointers are embedded into that object. And so no memory allocation is required to insert those objects into a list. A classic example of this is putting a process structure onto a scheduling queue. You would never want a vector for this, for reasons that a professional such as yourself should understand.



> Quite often but not always linked lists in C are intrusive.

Yes, and that's a significantly different data structure from a cons-cell based list, so I don't think it's particularly relevant. C and C++ certainly aren't examples of one of the languages lispm is claiming uses the Lisp model.

> And so no memory allocation is required to insert those objects into a list.

This is a pretty key distinction which doesn't apply to the linked list objects I'm talking about.


I haven't looked at Linux kernel sources, but I read about this "linked list" usage in the kernel. Embedded link pointers is also a good point.

Do you happen to have a good example for it?


Let's not pretend this proves your point in any way. Intrusive lists in a manually managed memory system are incomparable to the cons cell based linked lists in a garbage collected system which you're defending. This is particularly true when the intrustive lists require no memory allocation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: