
On 2/11/2012 1:43 AM, John M. Dlugosz wrote:
It seems to suppress exceptions for some things, but a format string like: "Funny format string: 25% off now! %z %x" still throws an exception "boost::bad_format_string: format-string is ill-formed" when exceptions(boost::io::no_error_bits) is used.
The example could be more enlightening… boost::format my_fmt(const std::string & f_string) { using namespace boost::io; format fmter(f_string); fmter.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit )); return fmter; } doesn't work for errors in the format string itself. It would be better illustrated along the lines of: boost::format my_fmt(const std::string & f_string) { using namespace boost::io; format fmter; // don't give it the string until after the exceptions are set fmter.exceptions( whatever ); fmter.parse (f_string); return fmter; }