Re:hey! include files!
Posted: Mon Aug 25, 2003 10:46 am
OK, my turn to flame:
IF YOUR KERNEL BECOMES LARGER AS A RESULT OF USING HEADER FILES, YOU ARE DOING IT WRONG.
A header file contains *only* function and variable declarations.
A simple header file: (the right way)
Then you'd implement malloc and free in one (and only one) source file, and provide a definition for errno (without extern) in one (and only one) source file. Then you'd link together all the source files.
There should be absolutely *no* change in size as a result of doing this.
However, there *will* be a change in size if you put the function and variable *definitions* in header files. This is because all the functions are being included in your kernel as many times as they are used. This is WRONG.
IF YOUR KERNEL BECOMES LARGER AS A RESULT OF USING HEADER FILES, YOU ARE DOING IT WRONG.
A header file contains *only* function and variable declarations.
A simple header file: (the right way)
Code: Select all
void *malloc(size_t bytes);
void free(void *ptr);
extern int errno;
There should be absolutely *no* change in size as a result of doing this.
However, there *will* be a change in size if you put the function and variable *definitions* in header files. This is because all the functions are being included in your kernel as many times as they are used. This is WRONG.