uList *l;
uListIter *i;
uL_add(l, "hello");
uL_add(l, "world");
uL_foreach(i,l)
printf("%s", i->toString(i));
typedef int (*DoFunction) (ListNode*);
void r_walklist(ListNode *n, DoFunction f)
{
if (n == NULL)
return;
f(n);
r_walklist(n->next, f);
}
int for_each(LinkList *l, DoFunction f)
{
r_walklist(l->head, f);
}
/////
int my_function(ListNode *n)
{
printf("Data is %s\n", n->data);
return 0;
}
LinkList *l = new_list();
for_each(l, my_function);
I understand that I can expose variables and functions using an API of some sort.
I am concerned that my naming conventions don't clash with the host application.
Consider the name Token for example. This would be the typedef name of my
struct Token structure. I understand that a struct tag is in it's own namespace,
but what if the host application also had a Token structure?
I realize the host application would need to include token.h in order to even have it defined, but
there would still be a clash somewhere down the line.
Since I will be compiling into a library format, will this even be an issue?