Subject: Re: [boost] [test] console_test_runner ported on *nix
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-09-19 20:05:34
Kevin Sopp <baraclese <at> googlemail.com> writes:
> > If what you saying is true we perform first step twice.
> > Second time before 6th
> > step. Why would compiler do this?
> Because in debug mode the compiler doesn't optimize this
> access. Maybe it does in release, maybe not. Maybe
> valgrind would still complain
I guess it's possible.
> > Can you test it? just create temp pointer
> > test_unit* tu_ptr = tu.second; before delete.
> I had to change the code like this to make it work:
> // the delete will erase this element from map
> test_unit* tu_ptr = tu.second;
> m_test_units.erase( tu.second->p_id );
> if( test_id_2_unit_type( tu_ptr->p_id ) == tut_suite )
> delete (test_suite const*)tu_ptr;
> delete (test_case const*)tu_ptr;
> and I commented out the deregister_test_unit() code.
> Or first delete the test_unit then erase tu from the map.
> I like to destroy objects in the opposite order in which
> they were created.
Why not just add
test_unit* tu_ptr = tu.second;
and keep everything else the same.
deregister_test_unit have to be invoked from test_unit destructor for completely
different reason (to handle exceptions during custom test_unit construction).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk