From: Shriramana Sharma <samjnaa@gmail.com>
To: Glynn Clements <glynn@gclements.plus.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Function pointers to inline functions
Date: Fri, 25 May 2007 11:32:10 +0530 [thread overview]
Message-ID: <46567BE2.4010401@gmail.com> (raw)
In-Reply-To: <17939.60731.269679.612012@cerise.gclements.plus.com>
Glynn Clements wrote:
> run-time callable version of the function. This switch does not
> affect `extern inline' functions.
What would be the purpose of "extern inline"?
I mean, inlining is done by the compiler, and extern is only useful to
tell the linker to resolve references to a variable or function that is
initially defined in another object file.
I tried putting an inline function *definition* in lib.cpp:
inline int foo ( void ) { return 2 ; }
and a *declaration* to that function qualified by extern inline in main.cpp:
# include <cstdio>
extern inline int foo ( void ) ;
int main ( void )
{
printf ( "%d\n", foo () ) ;
}
The session transcript:
$ g++ -c main.cpp lib.cpp
main.cpp:3: warning: inline function ‘int foo()’ used but never defined
$ g++ -o main main.o lib.o
main.o: In function `main':
main.cpp:(.text+0x12): undefined reference to `foo()'
collect2: ld returned 1 exit status
$
So extern for inline functions does not work as for normal functions --
so what is the use of extern inline?
Shriramana Sharma.
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2007-05-25 6:02 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 [this message]
2007-04-04 18:33 ` Steve Graegert
2007-04-27 17:01 ` Shriramana Sharma
2007-05-04 13:40 ` Glynn Clements
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=46567BE2.4010401@gmail.com \
--to=samjnaa@gmail.com \
--cc=glynn@gclements.plus.com \
--cc=linux-c-programming@vger.kernel.org \
/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).