Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Aug 2002 22:25:28 +1000
From:      Edwin Groothuis <edwin@mavetju.org>
To:        Gianmarco Giovannelli <gmarco@giovannelli.it>
Cc:        questions@freebsd.org
Subject:   Re: recursive include, why FreeBSD not ?
Message-ID:  <20020818122528.GD785@k7.mavetju>
In-Reply-To: <5.1.1.6.2.20020818112527.0178a268@194.184.65.4>
References:  <5.1.1.6.2.20020818112527.0178a268@194.184.65.4>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

Edwin
-- 
Edwin Groothuis      |            Personal website: http://www.MavEtJu.org
edwin@mavetju.org    |    Weblog: http://www.mavetju.org/weblog/weblog.php 
bash$ :(){ :|:&};:   | Interested in MUDs? http://www.FatalDimensions.org/

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?20020818122528.GD785>