W dniu 3.07.2023 o 18:29, Rafał Pietrak pisze:
Hi David,
[--------------]
4. It is worth taking a step back, and thinking about how you would
like to use these pointers. It is likely that you would be better
thinking in terms of an array, rather than pointers - after all, you
don't want to be using dynamically allocated memory here if you can
avoid it, and certainly not generic malloc(). If you can use an
array, then your index type can be as small as you like - maybe
uint8_t is enough.
I did that trip ... some time ago. May be I discarded the idea
prematurely, but I dropped it because I was afraid of cost of
I remember now what was my main problem with indexes implementation:
inability to express/write chain "references" with them. Table/index
semantic of:
t[a][b][c][d].
is a "multidimentional table" which is completely different from
"pointer semantic" of:
*t->a->b->c->d
It is quite legit to do a full circle around a circular list this way,
while table semantics doesn't allow that.
Indexes are off the table.
-R