The list code is trivial, but when you have 10 classes of list and no type
safety between independent list classes or even between the list head and list
item types, there is a strong possibility you will pass the wrong argument to
some list routine because there is nothing to stop you.
The list code is trivial. It doesn't make debugging difficult. It is
bottom-line knowledge. But why make things difficult for yourself -- just to
prove you can?
I can say a lot of good and bad things about C++, but at least it lets you do
this kind of thing with type safety and without ugly macros.
> I have one additional comment to the current implementation:
> >
> > #define TS_LINK_TO_ITEM(ITEM_TYPE,LINK_NAME,LINK) \
> > ((ITEM_TYPE *)((char *)(LINK)-(unsigned long)(&((ITEM_TYPE *)0)->LINK_NAME)))
>
> As long as your pointers are 32bit this seems to be ok. But on
> 64bit implementations pointers are not (unsigned long) so this cast
> seems to be wrong.
-josh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/