* C++ operators in gcc
@ 2005-09-23 21:48 Tommy Vercetti
2005-09-24 9:03 ` Ingo Krabbe
2005-09-26 11:21 ` John Love-Jensen
0 siblings, 2 replies; 4+ messages in thread
From: Tommy Vercetti @ 2005-09-23 21:48 UTC (permalink / raw)
To: gcc-help
Hi list
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?
please CC me on replies.
--
Vercetti
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: C++ operators in gcc
2005-09-23 21:48 C++ operators in gcc Tommy Vercetti
@ 2005-09-24 9:03 ` Ingo Krabbe
2005-09-26 11:21 ` John Love-Jensen
1 sibling, 0 replies; 4+ messages in thread
From: Ingo Krabbe @ 2005-09-24 9:03 UTC (permalink / raw)
To: gcc-help
Does this really make the binary file a bit larger. I don't think so. Every
class you define (or structure with C) is automatically be able to be copied
(in a flat manner of course) by the operator =. I think that someone who
told you meant that behaviour, that is part of the ISO definition as I
suppose and as such not specific to gcc.
I assume there would be no single byte of code blow up for this behaviour.
BYE INGO
Am Freitag, 23. September 2005 23:48 schrieb Tommy Vercetti:
> Hi list
>
> 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?
>
> please CC me on replies.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: C++ operators in gcc
2005-09-23 21:48 C++ operators in gcc Tommy Vercetti
2005-09-24 9:03 ` Ingo Krabbe
@ 2005-09-26 11:21 ` John Love-Jensen
2005-09-26 18:40 ` Ingo Krabbe
1 sibling, 1 reply; 4+ messages in thread
From: John Love-Jensen @ 2005-09-26 11:21 UTC (permalink / raw)
To: Tommy Vercetti, MSX to GCC
Hi Tommy,
In C++, every class some freebies. If you write this...
class Foo
{
};
...the compiler generates this...
class Foo
{
public:
Foo();
Foo(Foo const&);
~Foo();
Foo& operator = (Foo const&);
Foo* operator & ();
Foo const* operator & () const;
};
(I presume the definitions of these methods are obvious.)
If you don't want the compiler to generate one-or-more of those functions,
you could explicitly declare them in a private section, and leave them
unimplemented.
HTH,
--Eljay
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-26 18:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23 21:48 C++ operators in gcc Tommy Vercetti
2005-09-24 9:03 ` Ingo Krabbe
2005-09-26 11:21 ` John Love-Jensen
2005-09-26 18:40 ` Ingo Krabbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).