* strange code in linux kernel
@ 2009-10-06 3:34 Rajat Jain
2009-10-07 18:44 ` Michal Nazarewicz
0 siblings, 1 reply; 2+ messages in thread
From: Rajat Jain @ 2009-10-06 3:34 UTC (permalink / raw)
To: Linux Newbies, newbie
Hi List,
I found that there are some weird looking instances in kernel where a
function has been DEFINED (as opposite to DECLARED) using and "extern"
keyword. For e.g., the following code in arch/alpha/include/asm/io.h:
extern inline void __iomem *generic_ioportmap(unsigned long a)
{
return alpha_mv.mv_ioportmap(a);
}
Using a definition along with extern does not make any sense to me.
Can some one please enlighten what is its use / purpose?
Thanks,
Rajat Jain
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: strange code in linux kernel
2009-10-06 3:34 strange code in linux kernel Rajat Jain
@ 2009-10-07 18:44 ` Michal Nazarewicz
0 siblings, 0 replies; 2+ messages in thread
From: Michal Nazarewicz @ 2009-10-07 18:44 UTC (permalink / raw)
To: Rajat Jain; +Cc: Linux Newbies, newbie
[-- Attachment #1: Type: text/plain, Size: 1116 bytes --]
Rajat Jain <rajat.noida.india@gmail.com> writes:
> I found that there are some weird looking instances in kernel where a
> function has been DEFINED (as opposite to DECLARED) using and "extern"
> keyword. For e.g., the following code in arch/alpha/include/asm/io.h:
>
> extern inline void __iomem *generic_ioportmap(unsigned long a)
> {
> return alpha_mv.mv_ioportmap(a);
> }
>
> Using a definition along with extern does not make any sense to me.
> Can some one please enlighten what is its use / purpose?
Note that at the same time an "inline" keyword has been used. You might
want to refer to GCC's documentation in particular
<http://gcc.gnu.org/onlinedocs/gcc/Inline.html> for more information.
Google also pointed to this site
<http://www.greenend.org.uk/rjk/2003/03/inline.html> which also might
have some insight.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-07 18:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-06 3:34 strange code in linux kernel Rajat Jain
2009-10-07 18:44 ` Michal Nazarewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox