aaron wrote:
> I am just trying to write a simple IPv6 socket app.
> after #including <netinet/in.h> I noticed that I have to include <sys/types.h>
> BEFORE <netinet/in.h> which struck me as rather strange...
> 
> Should not .h files include the depending .h files themselves so that all
> dependencies of type / struct / #define definitions are met automatically?


Such an arrangement is called "promiscuous includes".

The problems with doing this are many, but the main ones are:

o       Including a file to get something expected into the namespace
        drags unexpected things into the namespace (perhaps a lot of
        them).

o       Compilation times go up geometrically

o       The programmer is shielded from explicit knowledge of the
        included files; this is bad, since it's the programmer's
        job to know these things

o       The resulting code is not portable to all platforms

o       Header files that do this are not technically standards
        compliant, since the standards dictate which header files
        are needed to access which functions in the API.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to