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 

trivial constructor

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
bml
Guest





PostPosted: Fri Jan 30, 2004 8:18 pm    Post subject: trivial constructor Reply with quote



Is "Trivial constructor" either a default constructor generated by compiler
or the one you write but it does nothing (empty inside method definition)?

Is it required by C++ standard to bypass "construction" in case of trivial
constructor, or just implementation-dependent?

In which cases is a construction bypassed?

Thanks a lot!


Back to top
Ron Natalie
Guest





PostPosted: Fri Jan 30, 2004 8:28 pm    Post subject: Re: trivial constructor Reply with quote




"bml" <lee4rai (AT) yahoo (DOT) com> wrote

Quote:
Is "Trivial constructor" either a default constructor generated by compiler
or the one you write but it does nothing (empty inside method definition)?

Is it required by C++ standard to bypass "construction" in case of trivial
constructor, or just implementation-dependent?

In which cases is a construction bypassed?

To answer the questions in reverse order. No construction occurs when the
constructor is trivial.

However, for a class to have a trivial constructor means more than it just has
the compiler generated one. The class also needs to have no virtual functions,
no virtual bases, and all of it's subobjects (bases and non-static members) must
also have trivial constructors.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) 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.