On Tue, 2 Jul 2002, Ian Dowse wrote:

> In message <[EMAIL PROTECTED]>, Jonathan Lemon writes:
> >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.
>
> Note that this of course is not "safe from element removal" in
> general; it is just safe when you remove any element other than the
> next element, whereas TAILQ_FOREACH is safe when you remove any
> element other than the current one. For example it would not be
> safe to call a callback that could potentially remove arbitrary
> elements.
>
> It may be clearer in this case just to expand the macro in the code
> so that it is more obvious what assumptions can be made.

This would be clearer in all case :-).  I think even the committer of
the FOREACH macros thinks that they shouldn't be used if the list
traversal has any surprises.

Bruce


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

Reply via email to