Originally Posted By: Uhrwerk
The only alternative is caching the value

Which might not be a bad idea after all. Generally speaking it's better to wrap the linked list into some kind of container which abstracts the process of adding and removing references to the list so you don't have to implement it over and over again every time you need a linked list (and the container can also keep track of the number of nodes).
I have posted a fairly basic example of such a linked list here: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=408638#Post408638


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com