Re: static functions
--Signature=_Thu__31_Mar_2005_17_36_11_+0200_vgA6_sJA1H1d3XGB
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, 31 Mar 2005 16:11:17 +0100
Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> 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 functi=
ons
> that have no return value?=09
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,
--=20
Miguel Mendez <flynn@energyhq.es.eu.org>
http://www.energyhq.es.eu.org
PGP Key: 0xDC8514F1
--Signature=_Thu__31_Mar_2005_17_36_11_+0200_vgA6_sJA1H1d3XGB
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)
iD8DBQFCTBjwnLctrNyFFPERAqgwAKCxj2j42YWp5GzHQUpdZMKPX2hdaACgqJye
Bsdd2OK3bIMGqbmodt46tKk=
=NRzz
-----END PGP SIGNATURE-----
--Signature=_Thu__31_Mar_2005_17_36_11_+0200_vgA6_sJA1H1d3XGB--
討論串 (同標題文章)