static functions

Miguel Mendez flynn at energyhq.es.eu.org
Thu Mar 31 07:38:39 PST 2005


On Thu, 31 Mar 2005 16:11:17 +0100
Jonathon McKitrick <jcm at xxxxxxxxxxxxxxxxx> wrote:


> Sorry this is such a lame question, but I never quite figured out what
> 'static' does to a function declaration.  Obviously for a variable, it
> allocates memory for the lifetime of the process rather than on the stack just
> for one function call.  But what about 'static' for all the kernel functions
> that have no return value?	

static foo(blah blah) restricts the scope of the function to that
module, i.e. it's not visible outside that .c file. You usually do that
to keep private functions from being called from somewhere else. That
way other parts of the program will only talk to the published API.

Cheers,
-- 
Miguel Mendez <flynn at xxxxxxxxxxxxxxxxxx>
http://www.energyhq.es.eu.org
PGP Key: 0xDC8514F1

Attachment:
pgp00006.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00006.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20050331/eef677d7/attachment-0018.obj>


More information about the Kernel mailing list