Messages in this thread | | | Subject | Re: [2.6 patch] loop.c: make two functions static | From | Arjan van de Ven <> | Date | Sun, 23 Jan 2005 12:03:50 +0100 |
| |
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/
| |