Re: static functions?

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

 



> > > 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.
> 
Thanks for your comments. I have just started to learn the ropes and
your clarifications  were very helpful.
Shourya

--
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