On Tue, 2 Jul 2002, Jonathan Lemon wrote:

> What do people think about adding the following macro to <sys/queue.h>?
> (I don't care much about the name, just the functionality)
> 
>     #define TAILQ_FOREACH_TMP(var, tmp, head, field)                     \
>             for ((var) = TAILQ_FIRST((head));                            \
>                 (var) && (((tmp) = TAILQ_NEXT((var), field)) || 1);      \
>                 (var) = (tmp))

Certainly this is moving in the right direction..
(acknowleging the problem).. It does the job.
but if someone knows to use it then they probably also
know to use a temp variable themselves. 

It does work in that there is very little the writer can do to screw this
up.

The question is simply "is it waranted?"
It does add complexity.. I guess it needs to be added to all
the other types as well (LIST, STAILQ etc)

> 
> Essentially, this provides a traversal of the tailq that is safe 
> from element removal, while being simple to drop in to those sections
> of the code that need updating, as evidenced in the patch below.
> -- 
> Jonathan



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to