include files -- help needed

chaplin chaplin at keinstr.uucp
Fri Jun 21 03:01:44 AEST 1991


In article <1966 at nixsin.UUCP> koerber.sin at sni.de writes:
>In article <1991Jun7.233854.11170 at arcturus.uucp> guthriew at 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 at keinstr.uucp / CI$: 76307,3506          / felt I was found when He
#include <disclaimer.h>                        / looked at me with His
#include "disclaimer.h" /* cover all bases */ / forgiving eyes." - Michael Card



More information about the Comp.lang.c mailing list