lkml.org 
[lkml]   [2005]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [2.6 patch] loop.c: make two functions static
From
Date
On Sun, 2005-01-23 at 18:32 +0800, andyliu wrote:
> hi, adrian
>
> i always see patches which set functions and variables to static.
> what's the main difference between static and non-static things?

1) namespace; static functions/variables are not visible name wise to
other .c files
2) optimisation: because of 1), gcc can know that there are no outside
users (assuming also no address-off is taken, which gcc also knows), and
in that case gcc can do a series of extra optimisations (such as more
agressive inlining, since gcc knows the exact user count of the function
now, but also gcc 3.4 will do things like make the function be regparm=3
equivalent, tail/head optimisations are possible (eg partial inlining)



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.028 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site