A solution to the multiple inclusion problem

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Oct 28 03:35:39 AEST 1989


In article <8956 at goofy.megatest.UUCP> djones at megatest.UUCP (Dave Jones) writes:
-))In article <14240 at well.UUCP) nagle at well.UUCP (John Nagle) writes:
-)))	#ifndef XXX
-)))	#define XXX
-)))	...content...
-)))	#endif
-... do it this way...
-	#ifndef XXX
-	...content...
-	#define XXX
-	#endif

I recommend just the opposite.  If the body of the header #includes
itself recursively (which is a very useful thing to permit), then
the idempotency lock doesn't work right unless you set it before
the nested #inclusion.



More information about the Comp.lang.c mailing list