Re: static functions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2004-12-12 at 22:41 +0530, Shourya P. Bhattacharya wrote:
> On Fri, 10 Dec 2004 01:28:52 -0800 (PST), Alaios <alaios@xxxxxxxxx> wrote:
> > Why the most function in a kernel code must be
> > declared as static?? If i use some not static?
> > 
> It could be avoid symbol name conflicts. By declaring a function

Yes, that's the one (and main) reason: To avoid namespace pollution

> static we limit it's scope to the file in which it is defined.  This 
> way it will not interfere with functions with the same name declared
> in other files.

The other reason is: If a function is "static", it is not accessible
from another source file. Threrfore the compiler knows all possible
calls of that function and may inline the function completely.

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux