Warnings for unhandled c++ exceptions?

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Feb 3 20:12:00 GMT 2003


"Wesley W. Terpstra" <terpstra@ito.tu-darmstadt.de> writes:

| On Mon, Feb 03, 2003 at 01:41:54PM -0600, Chris Lattner wrote:
| > 
| > > My primary goals for this warning were solely: bug tracking and
| > > consistency verification. Nothing more.
| > ...
| > > In a large enough software project, you probably won't be calling many of
| > > these out-of-project methods (and such calls are suspect anyways), so the
| > > warnings are still useful in the context you describe.
| > 
| > Remember that one of the major problems with C++ exception specifications
| > is that they basically can't work with generic code.  For example, if you
| > had a throw clause on your copy ctor, you couldn't use an std::vector of
| > your class without getting a warning (because the code calling the copy
| > ctor doesn't have an exception specification).
| 
| That is very true. I had not considered this.
| 
| However, I think this can be remedied in the same way that offending inline
| methods can be: pretend they are part of the method which instantiates or
| inlines them.

If you can pretend that, then you can just pretend that you don't
violate ES.  As you might realize, C++ exception mechanism is not a
copy-n-paste of Java model -- in some sens, they are quite opposite.
I believe, that any argument that departs from "Java does ES like this
so C++ should do the same" will have hard time to convince me.

-- Gaby



More information about the Gcc mailing list