 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
qazmlp Guest
|
Posted: Mon Apr 11, 2005 3:06 pm Post subject: Re: Format of compiler generated derived destructor when bas |
|
|
Could anybody reply to this post? I would like to know what exactly
'C++ standard' mentions about this.
| Quote: | qazmlp1209 (AT) rediffmail (DOT) com (qazmlp) wrote in message
news:<db9bbf31.0504080226.71c45717 (AT) posting (DOT) google.com>...
I have a class like this:
class base
{
public:
virtual ~base() throw();
// Other members
};
Now, if I write a class like this:
class derived:public base
{
// Other members
};
What will/should be the format of the compiler-generated destructor for derived?
Will it be this:
- ~derived(); or
- virtual ~derived(); or
- virtual ~derived() throw();
|
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
|
|
| Back to top |
|
 |
Alberto Barbati Guest
|
Posted: Mon Apr 11, 2005 11:22 pm Post subject: Re: Format of compiler generated derived destructor when bas |
|
|
qazmlp wrote:
| Quote: | Could anybody reply to this post? I would like to know what exactly
Will it be this:
- ~derived(); or
- virtual ~derived(); or
- virtual ~derived() throw();
|
It's "virtual ~derived() throw();" The relevant paragraphs are:
10.3/4 "Even though destructors are not inherited, a destructor in a
derived class overrides a base class destructor declared virtual; [...]"
(also notice footnote 97: "The use of the virtual specifier in the
declaration of an overriding function is legal but redundant (has empty
semantics).")
15.4/13 "An implicitly declared special member function (clause 12)
shall have an exception-specification. If f is an implicitly declared
[...] destructor, [...] f shall allow no exceptions if every function it
directly invokes allows no exceptions."
Alberto
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|