RE: [Dev-C++] What is a static function
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2001-08-02 17:29:06
|
static functions or global variables have scope only at the compilation unit (in normal computers: file) where they are defined. They can not be seen outside of their compilation unit. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Albert Vilella Bertran > Sent: Thursday, August 02, 2001 2:48 PM > To: dev...@li... > Subject: [Dev-C++] What is a static function >=20 >=20 > I don't understand what is like to declare a function as=20 > "static". For example: >=20 > static void initBV() { > if (!inittedBV) > { > int i; > for (i=3D0; i<ArraySize(bV); i++) > bV[i] =3D -1; > bV['a'] =3D bV['A'] =3D A_B_V; > bV['b'] =3D bV['B'] =3D B_B_V; > bV['c'] =3D bV['C'] =3D C_B_V; > bV['d'] =3D bV['D'] =3D D_B_V; > bV['e'] =3D bV['E'] =3D E_B_V; > inittedBV =3D TRUE; > } > } >=20 > What is that code doing? > If I "malloc" something inside the function, what happens? Is=20 > the space able to be freed outside of the function? How is=20 > that "int i" variable managed, is it created always but not=20 > used unless the "if" condition is true? Can I put this kind=20 > of conditional declaration of functions in a non-static function? >=20 > I don't know much of it, you see! :) >=20 >=20 > _______________________________________________________________ > Do You Yahoo!? > Yahoo! Messenger: Comunicaci=F3n instant=E1nea gratis con tu=20 > gente - http://messenger.yahoo.es >=20 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users >=20 |