This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Re(2): GNU C++ compiler enhancement rqst
- To: Andrew Marlow <apm35 at student dot open dot ac dot uk>
- Subject: Re: Re(2): GNU C++ compiler enhancement rqst
- From: Bo Thorsen <bo at sonofthor dot dk>
- Date: Mon, 19 Mar 2001 08:36:45 +0100 (CET)
- Cc: <rth at redhat dot com>, <gcc at gcc dot gnu dot org>
On Sat, 17 Mar 2001, Andrew Marlow wrote:
> rth@redhat.com,Internet writes:
> >On Fri, Mar 16, 2001 at 11:01:30PM +0000, Andrew Marlow wrote:
> >> We have said that doSomethingElse will only throw exceptions
> >> of type E but it calls a routine that might throw any
> >> exception, which will be propaged, violating the throw list.
> >
> >No it won't be propagated. It'll be caught and verified
> >by doSomethingElse, which will call std::unexpected.
>
> You're right. But the point is that
> std::unexpected will be called. So in
> this case we have a runtime failure rather
> than a compile-time failure. The enhancement
> would make this a compile time failure.
Either you didn't fully understand Richard's answer or I'm
misunderstanding you. The way it's done is the right way to do it simply
because the C++ standard says it's the right way. Consider this code:
void bogus() throws () {
throw 1;
}
You can't even give a compile-error here (even though this would be simple
to do) since the standard says it's valid code. Sorry, but blame the C++
designers who IMHO should have done it the way you suggest.
Now, if you're proposing a warning instead, we can start talking.
Bo.
--
Bo Thorsen | Lahnsgade 31, st.
Free software developer | 5000 Odense C
SuSE Labs | Denmark