Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!fernwood!portal!cup.portal.com!ts From: ts@cup.portal.com (Tim W Smith) Newsgroups: comp.lang.c Subject: Re: Programming Style Message-ID: <41390@cup.portal.com> Date: Thu, 18 Apr 91 00:31:05 PDT Organization: The Portal System (TM) Distribution: usa References: <1991Apr16.154655.14204@hellgate.utah.edu> <28721:Apr1701:15:3791@kramden.acf.nyu.edu> I try to follow two rules with my include files: 1. An include file shall not cause harm by being included multiple times. 2. An include file shall include all other include files needed to make it work, unless that conflicts with the first rules. Rule #2 means that if you want, say, the structure definition for a user area, you say #include You do NOT have to say: #include #include #include #include #include #include #include #include Sometimes this can get ugly, though. I had a pair of include files that happened to need parts of each other. What needed to happen at compile time was that the compiler should see the first part of file A, then file B, and then the rest of file A. Each file ended up including the other, with appropriate conditionals to make sure the right thing happened, but it was not pretty. Tim Smith