Topic: Exception specification
Author: Don Eddleman <"Don Eddleman"@news.vanderbilt.edu>
Date: 1997/10/17 Raw View
I have a question about Exception specification. The ARM says that the
exception-specfication can be used as a suffix of a function
declarator. My question is does this declarator need to be in the
definition too? One compiler I use complains while another does not.
For ex.
class A
{
void method1() throw (exception1) {}
}
Does the definition need the throw?
void A::method1() throw (exception1)
{
...
}
Thanks
Don Eddleman
Vanderbilt University
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: jla@to.icl.fi (Jari Laaksonen)
Date: 1995/06/26 Raw View
Is exception specification allowed in a definition of
an overloaded operator? Like:
T & operator [] (int idx) throw (BadIndex) { ... }
I didn't find a syntax for operator-functions from
the ARM and the latest C++ standard draft.
// Albert
(Team OS/2)
email: jla@to.icl.fi
-----------=======================================
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/06/26 Raw View
In article 3ed@louhi.to.icl.fi, jla@to.icl.fi (Jari Laaksonen) writes:
>Is exception specification allowed in a definition of
>an overloaded operator? Like:
>
> T & operator [] (int idx) throw (BadIndex) { ... }
>
>I didn't find a syntax for operator-functions from
>the ARM and the latest C++ standard draft.
Yes, an exception specification is allowed. Overloaded operator functions
do not have a special syntax. The name of your example function is
"operator[]", which is just a good a name as "f", for example, so far
as syntax is considered.
---
Steve Clamage, stephen.clamage@eng.sun.com