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]
Other format: [Raw text]

Re: c++ default operators


On Fri, Sep 23, 2005 at 07:09:21PM +0200, Tommy Vercetti wrote:
> I was told that gcc by default, for every class creates operator =, and
> probably something else. This makes binary file bit larger than it
> suppose to be. Is it true, and if so, why this is the case ? Can gcc
> simply not generate that operator?

In the C++ language, we have the concept of the default assignment
operator and the default copy constructor, which are created if needed
by the compiler.  But gcc won't create these if they aren't used.

Another extra function people sometimes complain about is the two copies
of the constructor: the in-charge version is for constructing an instance
of the class, and the not-in-charge version is for initializing the base
portion of a derived class.  Getting rid of the not-in-charge version,
for cases where it isn't needed, would require something like Java's
"final" keyword.






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