Re: [Spca50x-devs] Adding gspca to the mainline kernel
- Date: Mon, 4 Jun 2007 23:28:31 -0400
- From: "Denver Gingerich" <denver@xxxxxxxxxx>
- Subject: Re: [Spca50x-devs] Adding gspca to the mainline kernel
On 6/4/07, Denver Gingerich <denver@xxxxxxxxxx> wrote:
> > > >The third is the abuse of header files to add webcam-specific code.
> > > >Header files should be used for function declarations, but NOT for
> > > >function implementations, especially when these implementations are
> > > >more than one line. The current .h files should be separated into .h
> > > >and .c files so the .c files can be compiled into their own object
> > > >files and then linked together to produce the gspca module.
> > >
> > > It is not "code quality" problem. It is only "code style" issue.
> > Sorry man, i like *.inc file, maybe because i work a lot with assembler :)
> I think if you asked around (especially among kernel developers), you
> would find that this is frowned upon for many reasons. I recall a
> post from Linus on the LKML about this. I'll find it and post back.
The relevant posts from Linus that I was thinking of are the following:
- in header files, we put "common definitions":
* data structure declarations
* external function and data declarations
* inline functions ("nicer but otherwise equivalent to a #define")
- but we do *not* put
* actual real code
* actual real data
because those go into C files.
If it has real code or data in it, it's a .c file, and you don't
#include it, you *compile* it and you *link* it.
Linus does go on to say that for every rule there are exceptions, but
he would rather not add new ugly stuff (suggesting that code added to
the kernel should follow the policy of no real code or data in header
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
Spca50x-devs mailing list