Date: Wed, 08 May 2002 11:46:19 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: aaron <aaron@lo-res.org> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: /usr/include/netinet/in.h Message-ID: <3CD9727B.B53067A4@mindspring.com> References: <200205071814.46995.aaron@lo-res.org> <200205071937.20043.aaron@lo-res.org> <3CD8B8D3.F605B84B@mindspring.com> <200205081449.12733.aaron@lo-res.org>
next in thread | previous in thread | raw e-mail | index | archive | help
aaron wrote: > On Wednesday 08 May 2002 07:34, Terry Lambert wrote: > > > Thanks for answering. I was under the impression that lots of linux apps > > > rely on promiscuous includes... so i expected them to be there in fbsd > > > just as well.. (but my memory of linux programming times is a bit fainted > > > already). > > > > Yes. They do. > > Would smthg like "what are promicous includes and why you don't want them" > be a topic for a developers (and or the ports-) handbook (at the right place)? Maybe. Basically, any time an include file includes another include file, with certain rare expections, it's hiding the relationship between the interfaces exposed into the namespace, and the include file that *actually* did the exposing. The general rule is "including includes from includes is bad". When someone says "promiscuous knowledge", they mean knowledge that has come through a covert channel. If you can use a manifest constant that was defined by an include file that another include file happened to include, then when you go to compile that program on another platform, you may or may not have that manifest constant in scope by the time it is used. If you don't, you'll get a compilation error (like the ones that started this thread). Software that includes all the include files specified as necessary by POSIX is guaranteed to not suffer from this type of error (though your code may have other errors that this would not fix ;^)). OS's that have promiscuous includes (e.g. "if you include stdio.h, everything else gets included for you") enable bad code to be written unknowingly, by programmers who fail to remember the interface requirements from the manual pages (or fail to check them when they don't remember, and rely on the compiler to tell them when they are missing an include file, so they can go read the manual page to find out which include file is missing). The general rule there is "bad code is bad". -- Terry 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?3CD9727B.B53067A4>