This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Re(2): GNU C++ compiler enhancement rqst


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]