At Tuesday 2003-08-05 17:36, you wrote:
In working with my date/time code I've encountered another problem with
Boost.  I can reproducibly get lexical_cast to segfault.  It happens when a
greg_month is lexical_cast to a string. I don't observe this behavior for
years or days, just months.  The segfault can be avoided by using
lexical_cast<string, int> instead of lexical_cast<string>, but this
shouldn't be necessary.

Test case (note that WinXP doesn't complain when programs segfault, hence
the Begin/End business):

crash.cc:
----
#include <boost/lexical_cast.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
using namespace std;
using namespace boost;
using namespace boost::posix_time;
using namespace boost::gregorian;

int main() {
    const ptime t(date(1969, Jul, 21), time_duration(2, 56, 15));

    cout << "Begin!" << endl;
    cout << lexical_cast<string>(t.date().month()) << endl;
    cout << "End!" << endl;
}

WinXP, vs.NET2003 (both debug and release builds) boost from anonymous cvs updated:
2003-08-05
10:00
that's MST.


Begin!
07
End!
Press any key to continue


I'm sorry I haven't built the libraries for my cygwin recently, I'll have to update my "get latest boost" script


Victor A. Wagner Jr.      http://rudbek.com
The five most dangerous words in the English language:
              "There oughta be a law"

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to