<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;feed=atom&amp;action=history</id>
		<title>Extern Vs Static Inline - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;action=history"/>
		<updated>2013-05-19T16:19:51Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;diff=73477&amp;oldid=prev</id>
		<title>Cschalle: Add category</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;diff=73477&amp;oldid=prev"/>
				<updated>2011-10-28T07:22:08Z</updated>
		
		<summary type="html">&lt;p&gt;Add category&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 07:22, 28 October 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;(grep for EXTERN_INLINE - it will show up in the alpha architecture), but&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;(grep for EXTERN_INLINE - it will show up in the alpha architecture), but&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;these are used for the traditional 'extern inline' reasons.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;these are used for the traditional 'extern inline' reasons.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Kernel]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key elinux:diff:version:1.11a:oldid:1981:newid:73477 --&gt;
&lt;/table&gt;</summary>
		<author><name>Cschalle</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;diff=1981&amp;oldid=prev</id>
		<title>RBot: Bot (Edward's framework)</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Extern_Vs_Static_Inline&amp;diff=1981&amp;oldid=prev"/>
				<updated>2007-03-06T03:33:02Z</updated>
		
		<summary type="html">&lt;p&gt;Bot (Edward&amp;#039;s framework)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page describes how 'extern inline' is used in the kernel vs. 'static inline', and some of the&lt;br /&gt;
tradeoffs involved.&lt;br /&gt;
&lt;br /&gt;
At one point, the kernel could not function properly when you forced the compiler to not inline&lt;br /&gt;
functions.  There are functions in the kernel which do not work properly when they are&lt;br /&gt;
expressed as functions (with function prolog and epilog code) rather than as inline code.&lt;br /&gt;
&lt;br /&gt;
In 2001, Linus said:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- &amp;quot;static inline&amp;quot; means &amp;quot;we have to have this function, if you use it&lt;br /&gt;
   but don't inline it, then make a static version of it in this&lt;br /&gt;
   compilation unit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 - &amp;quot;extern inline&amp;quot; means &amp;quot;I actually _have_ an extern for this function,&lt;br /&gt;
   but if you want to inline it, here's the inline-version&amp;quot;&lt;br /&gt;
&lt;br /&gt;
... we should just convert&lt;br /&gt;
all current users of &amp;quot;extern inline&amp;quot; to &amp;quot;static inline&amp;quot;. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
see http://www.uwsg.indiana.edu/hypermail/linux/kernel/0107.3/0466.html&lt;br /&gt;
and whole thread at: &lt;br /&gt;
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0107.3/index.html#440&lt;br /&gt;
&lt;br /&gt;
However, there are exceptions to this rule:&lt;br /&gt;
For example&lt;br /&gt;
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0107.3/0519.html says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[conversion from 'extern inline' to 'static inline']&lt;br /&gt;
Doesn't work for the ones in include/linux/parport_pc.h, which have&lt;br /&gt;
extern versions in drivers/parport/parport_pc.c. Gives build errors.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See http://www.greenend.org.uk/rjk/2003/03/inline.html for a good&lt;br /&gt;
discussion on inlining in GCC in general.&lt;br /&gt;
&lt;br /&gt;
The following are some reasons to NOT change 'extern inline' to 'static inline'&lt;br /&gt;
in order to preserve code correctness:&lt;br /&gt;
 - if function pointers are taken for functions marked 'extern inline', then&lt;br /&gt;
 they will all be to the same function, and will match.  However, if function&lt;br /&gt;
 pointers are takend for static inline functions, then they won't match and&lt;br /&gt;
 code which compares function addresses will behave differently.&lt;br /&gt;
&lt;br /&gt;
 - kernel developers sometimes use 'extern inline' to mark function which&lt;br /&gt;
 MUST not be inlined.  Although the compiler ''may'' choose to not inline&lt;br /&gt;
 a function so marked, this rarely occurs in practice.  By setting a function&lt;br /&gt;
 as 'extern inline', and then NOT providing as associated extern non-inline&lt;br /&gt;
 function to back it up, if the compiler fails to inline the function a linker&lt;br /&gt;
 error will be generated.  This guarantees that the code will either run&lt;br /&gt;
 with the function inlined, or that it cannot be run at all.&lt;br /&gt;
&lt;br /&gt;
So... when a kernel developer uses 'extern inline' without a backing&lt;br /&gt;
extern function, it is an indication of a function that MUST be inlined.&lt;br /&gt;
&lt;br /&gt;
There are other uses of 'extern inline' WITH backing extern functions&lt;br /&gt;
(grep for EXTERN_INLINE - it will show up in the alpha architecture), but&lt;br /&gt;
these are used for the traditional 'extern inline' reasons.&lt;/div&gt;</summary>
		<author><name>RBot</name></author>	</entry>

	</feed>