Boost Graph Very Strange Behavior
Dear All,
I have upgraded to Boost 1.47.0 and I have spent a day on the following
strange behavior that someone who knows Boost better may explain to me.
Consider the source below. If I uncomment the line:
//cout << "";
in line 39, then the program starts working, i.e., it outputs:
0x1
If I comment out line 39, then I get
0
There are no memory leaks.
This kind of stuff gives me nightmares.
Thanks for your help and sorry for the longish example.
Thanks,
-- Alex
-----------------------------------------------------------------------
#include
On Sun, 21 Aug 2011, Alexander Feldman wrote:
Dear All,
I have upgraded to Boost 1.47.0 and I have spent a day on the following strange behavior that someone who knows Boost better may explain to me. Consider the source below. If I uncomment the line:
//cout << "";
in line 39, then the program starts working, i.e., it outputs:
0x1
If I comment out line 39, then I get
0
There are no memory leaks.
This kind of stuff gives me nightmares.
Thanks for your help and sorry for the longish example.
I tried your example with GCC 4.6 on Linux and it worked just fine, both with and without the printout. BTW, it is not recommended to inherit from BGL (or STL) objects since they do not have virtual destructors and are not meant for that usage. -- Jeremiah Willcock
On 08/21/2011 01:03 AM, Jeremiah Willcock wrote:
On Sun, 21 Aug 2011, Alexander Feldman wrote:
Dear All,
I have upgraded to Boost 1.47.0 and I have spent a day on the following strange behavior that someone who knows Boost better may explain to me. Consider the source below. If I uncomment the line:
//cout << "";
in line 39, then the program starts working, i.e., it outputs:
0x1
If I comment out line 39, then I get
0
There are no memory leaks.
This kind of stuff gives me nightmares.
Thanks for your help and sorry for the longish example.
I tried your example with GCC 4.6 on Linux and it worked just fine, both with and without the printout. BTW, it is not recommended to inherit from BGL (or STL) objects since they do not have virtual destructors and are not meant for that usage.
I have just figured out that the problem appears with gcc 4.5.2 -O2 and the program runs fine with -O1. I think now, it is something related to inlining but I will investigate further. Thanks for the advise not inherit from BGL - will change that. Best, -- Alex
-- Jeremiah Willcock _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Alexander Feldman
-
Jeremiah Willcock