Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-12 17:02:58


Peter Dimov wrote:
> Stephen Torri wrote:
>
>> void
>> add_Component ( Component::ptr_t obj_ptr )
>> {
>> bool no_duplicate;
>> IdVertexMap_t::iterator pos;
>> Vertex_t node;
>>
>> if ( obj_ptr.get() == 0 )
>> {
>> std::cerr << boost::format("Exception throw in %s at
>> line %d") % __FILE__
>> % __LINE__
>> << std::endl;
>>
>> return;
>> }
>>
>> boost::tie (pos, no_duplicate) = m_index.insert
>> (std::make_pair(obj_ptr->get_ID(), node));
>
> MSVC 8 says that you're using an uninitialized 'node' variable here.
> Is this intended?

Not likely since this leads to a fault in property_map.hpp:351 where iter is
advanced past the end of the sequence.

You might want to investigate how to activate the debug mode of your
standard library implementation, if it supports one; this is invaluable in
hunting down such iterator errors. Your compiler probably warned about the
uninitialized variable, too; it's easy to miss an important warning if it's
buried in a flood of harmless ones, but spotting the problem early because
of it can be a real time saver.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net