Richard Guenther wrote:
> > It is known (but maybe not appropriately documented) that deleting
> > bits in the bitmap you iterate over is not safe.  If it would be me I would
> > see if I could make it safe though.

On Mon, Jun 22, 2009 at 10:06:38AM -0700, Jeff Law wrote:
> It's not a huge deal -- what bothers me is that it's not documented.
> Someone thought enough to document that the loop index shouldn't be
> modified in the loop, but didn't bother to mention that the bitmap
> itself shouldn't be modified in the loop.

As a general rule there is a performance cost for making iterators
on a data structure safe with respect to modifications of that data
structure.  I'm not in a position to say what the right solution is
in this case, but passes that iterate over bitmaps without modifying
those bitmaps shouldn't be penalized.  One solution sometimes used is
two sets of iterators, with a slower version that's safe under
modification.



Reply via email to