Boost logo

Boost Users :

From: Daniel Krügler (dsp_at_[hidden])
Date: 2006-06-14 02:51:23


Hello,

Since introduction of VC 8, boost::format causes an assertion failure,
if empty strings are provided as format arguments, e.g.

      std::string arg;
      boost::format frmt("%s"); // Alternatively use: "%1%"
      std::string res = (frmt % arg).str();

This defect is well known since end of 2005 (e.g. by Mick Hollins et al.
in the thread

"[Boost.Format] empty string argument causes VC 8.0 to assert"

or by J.S.Otis in the thread

"Assertion failure usign boost::format with Visual C++ 2005"

The defect was well-analyzed by Caleb Epstein and I share his opinion,
that this is due to a defect in boost::io::detail::mk_str, which
provides a null pointer as argument to std::string::append, which
violates its preconditions. The null pointer effectively is a result of
some streambuf::pbase() call, which is allowed to return a null result
under well-defined conditions.

My question is: Has this error been fixed since then?

Thanks in advance,

Daniel Krügler


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net