C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Format of compiler generated derived destructor when bas

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
qazmlp
Guest





PostPosted: Mon Apr 11, 2005 3:06 pm    Post subject: Re: Format of compiler generated derived destructor when bas Reply with quote



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





PostPosted: Mon Apr 11, 2005 11:22 pm    Post subject: Re: Format of compiler generated derived destructor when bas Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.