lists.zerezo.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** Re: [Mingw-users] GDB and backtrace solved



To Bob:
> Try compiling with -gstabs, that's what I have to do with the sjlj
> compiler. The debug information doesn't work otherwise.


YES, YES, YES. God exists. Thank you never enough.


To Giel
>> pENu::~pENu()
>> {
>> std::list <lQ*>::iterator iterL;
>> iterL = aLiQu->begin();
>> while ( iterL != aLiQu->end() )
>> { delete (*iterL);
>> iterL = aLiQu->begin();
>> }
>> }
> 
> On a less related side note. That code ^^ will produce an infinite loop.
> Which is because you delete the objects pointed to by the pointers from
> your container, but you don't advance the iterator to the next pointer
> in the container.
> 
> You'll need to call the ++ operator on your iterator to advance to the
> next element in the container. Thus something like this would loop over
> all elements properly (without looping infinitely):

What I didn't tell is that (*iterL) dtor modifies aLiQu list, removing
itself from it. So, I just set iterL again to aLiQu->begin().
When all elements are deleted, aLiQu is empty and so iterL==aLiQu->end()
and loop finishes.

Manolo


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users