Re: [Geekos-devel] why the Selector method is static?
Status: Pre-Alpha
Brought to you by:
daveho
From: David H. <da...@cs...> - 2003-02-03 14:31:31
|
On Mon, Feb 03, 2003 at 04:34:48AM -0800, Behrang Saeedzadeh wrote: > I have been looking at the GeekOS code for sometime now, but because I have not been involved with C/C++ for a long time, I cannot understand evert aspect of the code. > > As long as I know, a static function is only visible to the portions of its file that are after its declaration and is not visible outside of that file. The Selector method in the segment.h is defined to be static but it is referenced from some files other than the segment.h. How could it happen? The static modifier makes the function visible to all subsequent code in the entire translation unit. A translation unit is the .c file, AND all of the .h files it includes. > And, are the static functions defined in a file.h visible to the file.c? Yes. Basically, I used "static inline" functions in some header files rather than writing macro functions. In theory, the compiler will inline them into the functions that call them. -Dave |