Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-02-10 02:52:36

"Geoff Leyland" <gley001_at_[hidden]> wrote in message
> On 10/02/2004, at 6:54 PM, Jonathan Turkanis wrote:
> > I think boost should encourage best practices, not practices which
> > work acceptably only in limited circumstances without providing
> > substantial benefits.
> Fair call.
> > For miscellaneous errors, you can use one the
> > standard exception classes, such as runtime_error, using a
> > stringstream to format the results, if you like:
> >
> > stringstream s;
> > s << "somebody made " << x << " mistakes";
> > throw runtime_error(s.str());
> >
> > This gives you the results you want, doesn't it? Is it really that
> > inconvenient?
> Oh, well I'm alright, because I'll go on using my streamy exception
> where I think it's warranted.

No objection here.

> Convenience is an interesting question though. To some extent (no
> offence to the authors of excellent libraries that I use a lot and
> extremely grateful for) my use of boost::lambda and boost::bind
> to avoiding the inconvenience of hand writing function objects

That's what they're for. I like convenience too. ;-)

> Funny that gcc's runtime_error uses a string copy constructor that
> could potentially throw :-)

True, using the standard exception classes does not necessarily
address all the issues discussed in the guidelines. I haven't studied
the libstdc++ string class in detail, but I think it's a reference
counted string whose copy constructor shouldn't throw in the
circumstances we've discussed. Other libraries (Dinkumware, I think)
definitely have this problem.


Boost list run by bdawes at, gregod at, cpdaniel at, john at