From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: C & static Date: 26 Apr 1997 13:29:42 GMT Organization: Oxford University, England Lines: 31 Message-ID: <5jt006$mtq@news.ox.ac.uk> References: <01bc5055$7a3d2100$08b0f8ce AT didi> <5jnbhc$or AT star DOT cs DOT vu DOT nl> <5jnugr$8cu2 AT bingnews DOT binghamton DOT edu> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Bob Kematick (Bob AT ge DOT chem DOT binghamton DOT edu) wrote: : Ruiter de M (mdruiter AT cs DOT vu DOT nl) wrote: : : Ian Mausolus (mausolus AT ican DOT net) wrote: : : : What is the significance of the word "static" in front of a function name : : : in C? : [ snip ] : : That means, that the function is declared local to the file. No other file : : can use it (by means of a .h-file). : [ snip again] : Nonsense. [snipped example] That's not what he meant. If file1.c contains a function and file2.c calls it (having a suitable prototype) the linker will find the correct function. However, if the function in file1.c is declared static, file2.c is not allowed to use it; the linker will not find the function, and you will get an error. The point of the keyword is that if you have a function which is only used internally to the .c file it is in and another .c file attempts to use a symbol of the same name, an error will occur. Declaring the function static will remove this error. -- George Foot Merton College, Oxford