Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jan 2001 10:53:10 -0500
From:      "Matthew Emmerton" <matt@gsicomp.on.ca>
To:        "Geoffrey Crompton (RMIT Guest)" <ghcrompton@gecko.eric.net.au>
Cc:        "FreeBSD-Questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: programming in freebsd related questions
Message-ID:  <00b401c07b1d$70799c60$1200a8c0@gsicomp.on.ca>
References:  <20010110121911.A29635@gecko.eric.net.au> <Pine.BSF.4.21.0101092020020.53322-100000@xena.gsicomp.on.ca> <20010110165043.A31845@gecko.eric.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
> On Tue, Jan 09, 2001 at 08:25:38PM -0500, Matthew Emmerton wrote:
> > On Wed, 10 Jan 2001, Geoffrey Crompton (RMIT Guest) wrote:
> >
> > >   When I #include things like sys/socket.h and netinet/in.h, I get
heaps
> > > of compiler errors, unless I do a #include <sys/types.h> before I
#include
> > > the others. Why is that?
> >
> > Because that's the way it is.  <sys/types.h> defines many things that
are
> > used by other header files, such as <sys/socket.h> and <netinet/in.h>,
so
> > you have to include it first, as you've found out.  Depending on your
> > program, you may need to include <sys/param.h> _instead of_
> > <sys/types.h>. (You can't include both.)
>
>   Is there a design reason for why those files (<sys/socket.h>,
<netinet/in.h>)
> don't #include <sys/types.h>? Or is that just that way it is?

Since <sys/param.h> may need to be included instead of <sys/types.h>,
depending on the project, the other headers can't infer which is needed.
That's why they don't auto-include it.

>   Does <sys/param.h> define a superset of what is defined in
<sys/types.h>?

Yes.  <sys/param.h> includes <sys/types.h> as well as certain
system-dependant parameters (system version, system maxiums, etc.)

--
Matt Emmerton



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?00b401c07b1d$70799c60$1200a8c0>