Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!keinstr!chaplin From: chaplin@keinstr.uucp (chaplin) Newsgroups: comp.lang.c Subject: Re: include files -- help needed Message-ID: <1991Jun20.170144.1109@keinstr.uucp> Date: 20 Jun 91 17:01:44 GMT References: <1991Jun7.233854.11170@arcturus.uucp> <1966@nixsin.UUCP> Organization: Keithley Instruments, Cleveland, Ohio Lines: 36 In article <1966@nixsin.UUCP> koerber.sin@sni.de writes: >In article <1991Jun7.233854.11170@arcturus.uucp> guthriew@arcturus.uucp (Guthrie;Wade) writes: >> >>In order to follow the guidelines of >> >> 1) no nested include files and >> 2) limiting the scope of globals and typedefs, > >Why no nested include files? They are a *GOOD THING*, especially when one >include file automatically includes the definitions it references itself. On >pre-ansi compiler you must be a bit carefule about multiple inclusions though, >since not all headers have the > >#ifndef THIS_IS_A_UNIQUE_DEFINE >#define THIS_IS_A_UNIQUE_DEFINE >... >#endif > >code to skip the file when it was already included. Maybe you could add them >to your standard header files to make it even easier on the programmer. Just >be sure to pick unique_defines that are guaranteed to be really unique. > >Mathias One technique I have used to make the defines unique is to use the name of the header file. Eg, in my header file foobar.h you will find: #ifndef FOOBAR_H #define FOOBAR_H ... #endif -- Roger Chaplin / Instruments Division Engineering / "Though I'd been lost now I chaplin@keinstr.uucp / CI$: 76307,3506 / felt I was found when He #include / looked at me with His #include "disclaimer.h" /* cover all bases */ / forgiving eyes." - Michael Card