
On Thu, 12 Jun 2003 08:33:53 +0200, adutoit wrote
Hi.
The following little proggie bombs if I compile it with /O3 optimisation in Windows, using Intel compiler 7.0 and STLport (whatever the latest version number is). In short, I cannot use to_simple_string in any of my programs if I have any form of optimisation turned on.
Unfortunately it is very hard for me to help since I don't have your environment. Perhaps you can put some I/O traces in to see if we can isolate where it is crashing. Perhaps you annotate boost/date_time/date_formatting.hpp ~ line 69 in ymd_formatter, method ymd_to_string. Here's what you are looking for. I've added a few cout's to gather data: static std::string ymd_to_string(ymd_type ymd) { typedef typename ymd_type::month_type month_type; std::ostringstream ss; ss << ymd.year; std::cout << "year ok" << std::endl; if (format_type::has_date_sep_chars()) { ss << format_type::month_sep_char(); } //this name is a bit ugly, oh well.... month_formatter<month_type,format_type>::format_month(ymd.month, ss); std::cout << "month format ok" << std::endl; if (format_type::has_date_sep_chars()) { ss << format_type::day_sep_char(); } std::cout << "month ok" << std::endl; ss << std::setw(2) << std::setfill('0') << ymd.day; std::cout << "day ok" << std::endl; return ss.str(); } Also, this shouldn't matter, but try changing your test to remove the leading '0' from the month:
std::cout << to_simple_string( date( 2003,6,12) ) << std::endl;
Thx, Jeff