C Style

Peter da Silva peter at ficc.uu.net
Wed Jan 11 09:11:41 AEST 1989


I have been told that the following mechanism for handling nested includes
is unreliable and/or unportable, but for the life of me I can't see how:

graphics.h:
	#ifndef GRAPHICS_H
	#define GRAPHICS_H
	...
	#endif

windows.h:
	...
	#ifndef GRAPHICS_H
	#include GRAPHICS_H
	#endif
	...

menus.h:
	...
	#ifndef GRAPHICS_H
	#include GRAPHICS_H
	#endif
	...

Now this allows a programmer to include windows.h and menus.h, without
having to (a) know they need to include graphics.h, and (b) worry about
graphics.h being included twice.

What's wrong with this picture?
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Work: uunet.uu.net!ficc!peter, peter at ficc.uu.net, +1 713 274 5180.   `-_-'
Home: bigtex!texbell!sugar!peter, peter at sugar.uu.net.                 'U`
Opinions may not represent the policies of FICC or the Xenix Support group.



More information about the Comp.lang.c mailing list