Subject: Re: problems with arpa/inet.h
To: None <rhialto@polder.ubc.kun.nl, scottr@Plexus.COM>
From: Olaf Seibert <rhialto@polder.ubc.kun.nl>
List: current-users
Date: 06/11/1998 12:53:20
scottr@beech.pd.tgi.plexus.com wrote:
> On Wed, 10 Jun 1998 rhialto@polder.ubc.kun.nl wrote:
>
> > This is no argument. If a header A should be included before header B,
> > because B uses something from A, then it doesn't matter for the amount
> > of preprocessed output if A is included by B, or by the main program.
>
> This is not necessarily true, but in the particular case of arpa/inet.h,
> it certainly is.  Thanks for pointing out my error.

I'll admit that if A is included from both B and the main program, and
if A has the canonical multiple-inclusion protection, but the
preprocessor does not detect that, there might be difference in the
amount of whitespace, and/or #line directives.

To overcome this, one could do a double protection, as in the AmigaOS
system header files:

<exec/types.h> is:

    #ifndef EXEC_TYPES_H
    #define EXEC_TYPES_H
    ...all type definitions...
    #endif

<exec/exec.h> contains:

    #ifndef EXEC_TYPES_H
    #include <exec/types.h>
    #endif

This is slightly more typing work but works optimally with every
C preprocessor. (obNetBSD) I would not be against such a construct in
the NetBSD headers.

> --scott
-Olaf.
--
___ Olaf 'Rhialto' Seibert                D787B44DFC896063 4CBB95A5BD1DAA96 
\X/ * You are not expected to understand this.    rhialto@polder.ubc.kun.nl