#define LIST_FOREACH(list, index, value, code)
I'd prefer #define LIST_FOREACH(list, index, value) \
for(index = 0, value = list->items[0]; \
index < list->size; \
index++, value=list->items[index])
It lets you treat a LIST_FOREACH(...) as a normal for(...) in terms of the other syntax.edit: I did some looking around and determined that the following is probably BS
[1] If you're wondering why I didn't do
index++, value = list->items[index]
it's because expressions separated by a comma can be evaluated in any order (I believe). My friend ran up against it with a bug in jscore.