Re: [PATCH 3/7] drivers: usb: Include appropriate header file inhcd.h

From: Alan Stern
Date: Thu Dec 19 2013 - 14:48:57 EST


On Thu, 19 Dec 2013, Sergei Shtylyov wrote:

> I don't really see how C language design can justify header files that
> once included, require each .c file to #include other headers ahead of them,
> each time such header is used. In my opinion, it's just crazy.

Okay, you've convinced me.

In this case, anyway, it makes sense to add the structure declarations
to the header file. That's a lot less objectionable than adding a new
include line (even though the compiler doesn't care).

By the way, if anyone cares, this discussion reminded me something
interesting. It's sort of the opposite side of the coin, a case where
a source file would do something _different_ each time it was included.

The program itself was a fairly simple thing to calculate and print
prime numbers. The interesting part was that this didn't happen when
you would _run_ the program -- it happened when you _compiled_ the
program! Lots of preprocessor stuff to make it work. And the only way
to persuade the compiler to go into a loop was for the source file to
include itself. :-)

Alan Stern

--
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/