Hacker News new | ask | show | jobs
by coliveira 1078 days ago
> hacks like conventionally placing the next/prev pointer in structs

This is not a hack, it is the way it should be in C.

1 comments

Except that that's a linked list and not an array.
You can store your 'list items' in an array and still link to random items in the array - although an index instead of a pointer would make more sense in that case, but what else is an index than a pointer with fewer bits ;) The main advantage being that you don't need to alloc/free individual items.
Great, so now we're writing our own memory allocator?
If you want to call about 10 lines of trivial code a 'memory allocator', then yup, we're totally going to write our own 'memory allocator' ;)