From: Glynn Clements <glynn@gclements.plus.com>
To: Shriramana Sharma <samjnaa@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: -ffunction-sections -Wl,--gc-sections trick and class members
Date: Fri, 4 May 2007 14:31:17 +0100 [thread overview]
Message-ID: <17979.13733.881263.496494@cerise.gclements.plus.com> (raw)
In-Reply-To: <4630E1C7.40804@gmail.com>
Shriramana Sharma wrote:
> > OTOH, I suspect that virtual methods are always "used" when
> > intialising the virtual method table, so it's less likely that they
> > could be omitted.
> >
> > If you want a definite answer, test it.
>
> Well I tested it and it is obvious that the trick is able to weed out
> unused class members too -- run the contents of the attachment.
>
> But I did not comprehend how you suspect that having virtual function (I
> presume methods are the same as functions) will create different
> results.
Non-virtual methods are referenced directly from the object file in
which they are used. If you don't call them, they won't be referenced.
Virtual methods are called through a function pointer in the virtual
method table. The only direct reference to the function will be in the
code which initialised the table. But that initialisation will occur
regardless of whether or not anything calls the method.
--
Glynn Clements <glynn@gclements.plus.com>
prev parent reply other threads:[~2007-05-04 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-19 14:38 -ffunction-sections -Wl,--gc-sections trick and class members Shriramana Sharma
2007-04-19 15:13 ` Glynn Clements
2007-04-26 17:30 ` Shriramana Sharma
2007-05-04 13:31 ` Glynn Clements [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17979.13733.881263.496494@cerise.gclements.plus.com \
--to=glynn@gclements.plus.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=samjnaa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).