[ prog / sol / mona ]

prog


Inalienable Core of "Practical" Programming Languages

14 2021-11-05 12:54

>>13
I figure you are talking of linked lists? That mostly depends on how they are used. Linked lists in general are pretty simple. If you are going for sequential access and manage to keep your elements in cache i doubt it'll be much of a difference. If you are talking about source complexity that's largely down to how they are implemented.

If done cleanly it will be mostly opaque (ie declare a pointer to your desired type initialized to NULL and pass a pointer to that to your allocator which spits out pointers to elements of said type, those element pointers can in turn passed to the destructor function, iterated using next/prev functions/macros or used like any other pointer of that type). There is nothing visible of the whole magic and if one whats to get fancy its all in a header ready to be force inlined and (partly) optimized away. A generic implementation is likely something about ~50 loc (including header) depending on how much extended functionality is required.

I can see how VLAs might appeal to high level programmers. From their perspective it's probably hard to imagine how something like this can be avoided or even be superfluous. Trust me, it's practically a non-issue. It's simply unneeded functionality with lots of downsides. Nothing more, nothing less.

23


VIP:

do not edit these