[Clam-devel] throw specifications
David García Garzón
dgarcia at iua.upf.edu
Mon May 18 03:14:13 PDT 2009
I fully aggree with you, indeed i guess that most developers do too. That's
why i guess that if some exception specification is used it might be a reason
for it, for example in exception object methods when inheriting from
std::exception. Maybe they are not justified but just try.
On Monday 18 May 2009 10:49:16 Dirk Griffioen wrote:
> I'd like to make a small remark about the throw-specifiactions: I think
> they should be avoided (and if possible, removed).
> As Herb Sutter writes: http://www.gotw.ca/gotw/082.htm:
> *4.* When is it worth it to write exception specifications on functions?
> Why would you choose to write one, or why not?
> In brief, don't bother. Even experts don't bother.
> Slightly less briefly, the major issues are:
> Exception specifications can cause surprising performance hits, for
> example if the compiler turns off inlining for functions with
> exception specifications.
> A runtime unexpected() error is not always what you want to have
> happen for the kinds of mistakes that exception specifications are
> meant to catch.
> You generally can't write useful exception specifications for
> function templates anyway because you generally can't tell what the
> types they operate on might throw.
> For more, see for example the Boost exception specification rationale
> available via http://www.gotw.ca/publications/xc++s/boost_es.htm (it
> summarizes to "Don't!").
> So would it be okay if I remove them as I see them?
> Best, Dirk
More information about the clam-devel