Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jun 2002 16:47:10 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Sergey Babkin <babkin@bellatlantic.net>
Cc:        Mike Barcroft <mike@FreeBSD.ORG>, "Greg 'groggy' Lehey" <grog@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/include pwd.h
Message-ID:  <200206102347.g5ANlA6I023876@apollo.backplane.com>
References:  <200206091939.g59JdJC05285@freefall.freebsd.org> <20020610004026.GD61036@wantadilla.lemis.com> <200206100049.g5A0nr1P004846@apollo.backplane.com> <20020609211243.C51371@espresso.q9media.com> <200206100314.g5A3EjTt005317@apollo.backplane.com> <20020609232020.F51371@espresso.q9media.com> <3D05364A.469A44A5@bellatlantic.net>

next in thread | previous in thread | raw e-mail | index | archive | help

:Mike Barcroft wrote:
:> 
:> Matthew Dillon <dillon@apollo.backplane.com> writes:
:> >     Which specification are you looking at?  I'm all for conforming to
:> >     standards but this is new to me.
:> 
:> Well, POSIX and X/Open were merged into on standard POSIX.1-2001
:> aka SUSv3.  I think the requirements that the typedefs be in each
:> header comes from the X/Open side, but I'm sure Bruce or Garrett could
:> elaborate.
:
:This (defining the types multiple times) is definitely not a part 
:of Unix95 nor Unix98. And the approach of defining the types multiple
:times looks very wrong to me.  It is absolutely bound to end up with
:types changed in some headers but not in the others. And I think that
:the whole argument about "namespace pollution" is completely bogus.
:
:> >     In anycase, if you are going to remove the sys/types.h dependancy
:> >     for pwd.h (and other headers) then you also need to document that in
:> >     the related manual pages.
:> 
:> It won't do any harm to additionally include <sys/types.h>, but you
:> are right, they should be updated.
:
:The standard way remove to the requirement of including <sys/types.h>
:before <unistd.h> is to include <sys/types.h> from inside <unistd.h>.
:
:-SB

    My worry here is that so *many* includes depend on things in sys/types.h,
    if we were to carry out this 'duplicate typedef' idea to its fullest
    extent we would have hundreds of dups over many of the header files
    in the system.  And even with that many programs would either still
    wind up having to include <sys/types.h>, or certain include files
    would still have to include <sys/types.h> due to heavy type 
    dependancies.

    So even with this methodology I see no way to be able to guarentee to
    a programmer that pollution from the contents of <sys/types.h> can be
    avoided, even if the programmer does everything right.

    This issue of pollution may be true, but if most programs wind up 
    including <sys/types.h> anyway it is something we just have to live 
    with.  The C language is not hierarchical, it's a fact of life.

    I do not think it will have a positive effect on the codebase and 
    it *will* seriously mangle the include files if the concept is taken
    to extremes.  If you take it to extremes you *might* be able to 
    reduce pollution from <sys/types.h>, but not eliminate it.  If you do
    not take it to extremes there isn't much of a point to doing it in
    the first place since there will be no deterministic way for the
    programmer to have any assurance of reduced pollution.  We wind up being
    screwed either way.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

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




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