Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Aug 2002 14:44:47 +0200
From:      Gianmarco Giovannelli <gmarco@scotty.masternet.it>
To:        Edwin Groothuis <edwin@mavetju.org>, Gianmarco Giovannelli <gmarco@giovannelli.it>
Cc:        questions@FreeBSD.ORG
Subject:   Re: recursive include, why FreeBSD not ?
Message-ID:  <5.1.1.6.2.20020818144206.020f9ef0@194.184.65.7>
In-Reply-To: <20020818122528.GD785@k7.mavetju>
References:  <5.1.1.6.2.20020818112527.0178a268@194.184.65.4> <5.1.1.6.2.20020818112527.0178a268@194.184.65.4>

next in thread | previous in thread | raw e-mail | index | archive | help
At 18/08/2002, Edwin Groothuis wrote:
>On Sun, Aug 18, 2002 at 11:32:47AM +0200, Gianmarco Giovannelli wrote:
> > I have a piece of code like this:
> >
> > #if defined(__OpenBSD__)
> >         #define __BYTE_ORDER BYTE_ORDER
> >         #define __LITTLE_ENDIAN LITTLE_ENDIAN
> >         #define __BIG_ENDIAN BIG_ENDIAN
> > #endif
> >
> > [...]
> >
> > #if defined(__FreeBSD__)
> >        #include <sys/types.h>
> >        #define __BYTE_ORDER BYTE_ORDER
> >        #define __LITTLE_ENDIAN LITTLE_ENDIAN
> >        #define __BIG_ENDIAN BIG_ENDIAN
> > #endif
> >
> >
> > If I remove the:
> >  #include <sys/types.h>
> > it doesn't compile while OpenBSD and Linux compile clean...
>
>Linux has the obsession of including include-files in the include
>files itself. For example, sys/socket.h includes sys/types.h(*)
>
>FreeBSD doesn't include that sys/types.h in sys/socket.h, therefor
>it will fail to compile.
>
>I don't know who is right, but if the man-page tells me to include
>sys/types.h and sys/socket.h I will do it that way and not the other
>way around and neither only sys/socket.h.
>
>(*) It might (or might not) be sys/types.h and sys/socket.h, but
>     that is the one which I think it was. I have had the same
>     experience a couple of times before.

Tnx for your kind reply...
Btw it seems not only Linux use the self inclusion. Also OpenBSD seems to 
act in this way, even if I really prefer the explicit way of doing things.

Another question: but should this be a compiler (gcc) or OS dependant thing ???





Best Regards,
Gianmarco Giovannelli ,  "Unix expert since yesterday"
http://www.gufi.org/~gmarco



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.1.6.2.20020818144206.020f9ef0>