Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 May 2002 01:58:50 -0400
From:      Brian T.Schellenberger <bts@babbleon.org>
To:        Greg Black <gjb@gbch.net>, Ian <freebsd@damnhippie.dyndns.org>
Cc:        freebsd-hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: /usr/include/netinet/in.h
Message-ID:  <20020509055851.5BA03BB29@i8k.babbleon.org>
In-Reply-To: <nospam-1020923159.81968@bambi.gbch.net>
References:  <B8FED3FA.CC8C%freebsd@damnhippie.dyndns.org> <nospam-1020923159.81968@bambi.gbch.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 09 May 2002 01:45 am, Greg Black wrote:
| Ian Noname wrote:
| | > The general rule is "including includes from includes is bad".
| |
| | Okay, it's time to point out that these are opinions, not rules, and
| | differing opinions exist.
|
| There's no shortage of opinions.  They are like arseholes:
| everybody has one.  But there are rules that have been carefully
| worked out by people who have put a lot of time into them, and
| those rules are documented in the man pages for each interface
| in the system.  A programmer who can read can get this stuff
| right without even rasing a sweat.
|
| | My opinion is that if a given header file requires some aspect of another
| | interface, that header should (nay, MUST) include what it needs for
| | itself, rather than relying on something external to "do the right
| | thing".   Why require thousands of programmers to remember all these
| | interdependancies as opposed to one programmer encoding the depenancy
| | once where it belongs and then everyone else can get on with their life
| | and get some real coding done.
|
| Why require programmers to learn their craft?  Why ask them to
| waste their precious time gaining basic proficiency?  Why expect
| them to bother to read the fine manuals for the interfaces they
| feel inclined to use?  Get a grip -- programmers ought to be
| competent at this stuff, especially when it must be just about
| the simplest thing they need to learn.

I've always thought that the sensible rule was:

- If the h file uses some other h file structure *internally* but doesn't 
expose it to the user, it should include it itself, but

- If the user will be using another interface that's "below" this one, then 
the user should include it.

That way the .c program has #includes that reflect the interfaces that it 
uses, no more and no fewer.

Surely that's sensible.


**BUT** this is beside the point.  When working with code withing a 
particular project (such as FreeBSD), you should conform to its conventions, 
not the other way 'round.

For example, it is obvious to any sensible observer that the terminating 
curly braces should be lined up with the *nested* code.  But the other folks 
I work with mostly don't see it that way, so I do it the other way because, 
really, consistency in such matters is more important than whether it meets a 
personal test for perfection.

This is a general property of collaboration: comprimises and consensus are a 
very important part of making it possible.

|
| | Programmer since 1972
| | C programmer since 1985
|
| Not yet a C programmer if the above is the best you can do.
|
| | Demagogue since... well, as long as I can remember.  :-)
|
| No comment.
|
| To Unsubscribe: send mail to majordomo@FreeBSD.org
| with "unsubscribe freebsd-hackers" in the body of the message

-- 
Brian T. Schellenberger . . . . . . .   bts@wnt.sas.com (work)
Brian, the man from Babble-On . . . .   bts@babbleon.org (personal)
                                        http://www.babbleon.org

http://www.eff.org                      http://www.programming-freedom.org 

If you smell the smoke you don't need to be told what you've got to do;
Yet there's a certain breed, so very in-between, they'd rather take a
vote.   -- DEVO  --  Here To Go

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




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