Boost logo

Boost :

From: Michiel Salters (michiel.salters_at_[hidden])
Date: 2005-02-09 12:29:02


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Doug Gregor
> Sent: woensdag 9 februari 2005 17:23
> To: boost_at_[hidden]
> Subject: Re: [boost] Wave C++ Review Begins Today - February 7, 2005
>
...
> Even dereferencing *last could be a bug, if it is
> past-the-end. For iterators referencing contiguous memory
> (vectors and pointers only, as you've said), one would need to write
>
> scanner.last = scanner.first + std::distance(first, last);

True, but that's an partial fix. For now, I've fixed that bug too
in my vector<char> wrapper but it's becoming complex. I'm afraid
someone will have to write re2cpp.
 
> > I really have to say Dinkumware did a fine job here, this
> would have
> > been very hard to find without these checks.
>
> FWIW, STLport and newer versions of GCC (Apple GCC 3.3, FSF
> GCC 3.4) have similar debugging modes. They've been
> invaluable in rooting out subtle bugs like those that stem
> from iterator invalidation.

Yep, although I'm currently wondering if they're 100% right. Is it
legal to compare iterators from different containers? I can't
find the appropriate wording so I'll just trust Dinkumware here.

My current problem is, somewhere deep down in cpp_macromap.hpp
a simple innocent if (first != last) statement (line 433)
triggers another assertion. These are iterator_facade's
(which I don't grok) and end up comparing iterators to two
distinct containers. Looking the other way on the callstack,
I see some deeply suspect iterators (singular, destroyed, ?)

Too messy to say what happened.

Regards,
Michiel Salters

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk