linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn@gclements.plus.com>
To: Shriramana Sharma <samjnaa@gmail.com>
Cc: Linux C Programming List <linux-c-programming@vger.kernel.org>
Subject: Re: Function pointers to inline functions
Date: Fri, 4 May 2007 14:40:10 +0100	[thread overview]
Message-ID: <17979.14266.175484.318241@cerise.gclements.plus.com> (raw)
In-Reply-To: <46322C77.8070803@gmail.com>


Shriramana Sharma wrote:

> I did some experimentation with pointers to inline and static inline 
> functions. Please unpack the attachment and run the build script.
> 
> You will observe that the nm files only differ in the last four lines, 
> and that too in only three of them.
> 
> The difference is that the executable built from the source with just 
> "inline" has the functions square, cube and fourthpower marked as "W" 
> which according to man:nm means that "The symbol is a weak symbol that 
> has not been specifically tagged as a weak object symbol".
> 
> In the same place, the executable built from the source with "static 
> inline" has the same functions marked "t" which denotes a local symbol 
> in the code section.
> 
> I actually expected static inline to make the entries for the functions 
> disappear but OK, I'm calling pointers to those functions, so they won't 
> disappear. But at least shouldn't they become weak objects, like they do 
> for "inline"?

There's no point in making them weak if they're local.

> Though I do not profess to fully understand what a weak object is, (upon 
> which matter I would like to learn more) it sounds like an object which 
> does not have a full separate existence. If an inline function is such a 
> weak object, how come a static inline one is not tagged as one?

A weak symbol is one which is only used as a last resort. If another
library defines a non-weak version of the same symbol, it will be used
in preference to the weak version.

-- 
Glynn Clements <glynn@gclements.plus.com>

  reply	other threads:[~2007-05-04 13:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 17:09 Function pointers to inline functions Shriramana Sharma
2007-04-04 18:23 ` Glynn Clements
2007-05-25  4:57   ` Shriramana Sharma
2007-05-25 22:41     ` Glynn Clements
2007-05-29 13:03       ` Shriramana Sharma
2007-06-04  7:08         ` Glynn Clements
2007-05-25  6:02   ` Shriramana Sharma
2007-04-04 18:33 ` Steve Graegert
2007-04-27 17:01   ` Shriramana Sharma
2007-05-04 13:40     ` Glynn Clements [this message]
2007-05-25  4:41   ` Shriramana Sharma
2007-05-25 22:45     ` Glynn Clements

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.14266.175484.318241@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).