Re: including .c files ?

From: H. Peter Anvin
Date: Fri Aug 08 2008 - 15:13:33 EST


Rene Herman wrote:

If you think about it -- in C, #include really at least conceptually means "cut & paste this in here, please" meaning headers are not anything special and .h and .c seperation is a mere convention.

As we all know, conventions exist _only_ to be violated...


The real issue is that the convention -- .c versus .h -- recognize *two* kinds of files, but there really are *three* kinds of files:

- Files meant to be included that generate no code (.h)
- Files meant to be included that generate code (???)
- Files not meant to be included (.c)

Some projects -- including the Linux kernel -- have adopted the convention that the middle type should be .c, others .h, others probably other variants. You typically want them treated as .h files for purposes of generating dependencies, but like .c files for purposes of, say, header file include guard checking.

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/