A solution to the multiple inclusion problem

David Fox fox at allegra.att.com
Fri Oct 27 11:51:45 AEST 1989


A problem with the idea of having the compiler recognize the

	#ifndef FOO
	#define FOO
	...
	#endif

arrangement (I wouldn't call it a construct) is what if the
including file explicitly #undefs FOO?  Then the semantics are
not preserved.  A somewhat unlikely occurence, I'll admit.

A problem I've run into with the construct itself (with a
standard preprocessor) is that I often create a new header
file by copying an old one.  You can guess what happens:
for some strange reason the compiler doesn't recognize the
new type name.

My real objection is that I don't like having to type three
lines in order to say one thing.  I don't go to great lengths
to reuse code rather than rewrite it just to sprinkle my code
liberally with obscure three line constructs that just mean
"not again!"

David Fox


--
+-----------------------------------------+ David Fox
|End tax incentives for leveraged buyouts!| fox at allegra.att.com
+-----------------------------------------+ (presumably)



More information about the Comp.lang.c mailing list