Mail Archives: djgpp/1997/06/12/04:56:14
Paul Shirley wrote:
>
> The gnu make/cpp documentation claims that it can spot this sort of
> enclosure in include files and avoid loading them more than once.
>
> Anyone know if it actually works? (I just assumed it would)
When I write my own header files and accidentally include them twice in
the same source file, I get all sorts of errors about multiply defined
constants and duplicate struct definitions and lots of other stuff.
Using the #ifndef __header_h__/#define __header_h__/.../#endif trick
solves the problem perfectly. Plus, it's the standard way to handle
it. What else could you ask for?
--
---------------------------------------------------------------------
| John M. Aldrich | "Be wary of strong drink. It can |
| aka Fighteer I | make you shoot at tax collectors-- |
| mailto:fighteer AT cs DOT com | and miss." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -