Path: utzoo!attcan!uunet!modcomp!joe From: joe@modcomp.UUCP Newsgroups: comp.lang.c Subject: conditional includes Message-ID: <8000011@modcomp> Date: 15 Jan 89 02:21:00 GMT Lines: 34 Nf-ID: #N:modcomp:8000011:000:1134 Nf-From: modcomp.UUCP!joe Jan 14 21:21:00 1989 Peter da Silva's discussion of the following construct [slightly modified]: main.c ... #include "windows.h" #include "menus.h" ... windows.h: menus.h ... ... #ifndef GRAPHICS_H #ifndef GRAPHICS.H #include "graphics.h" #include "graphics.h" #define GRAPHICS_H #define GRAPHICS.H #endif #endif ... ... reminded me of a feature that I've always wanted in cpp: the ability to do conditional includes in a way less clumsy than the above examples. Specifically, I would like cpp to remember which files have already been included, and to automatically NOP any extra requests. Of course, a conditional include service should not be called "#include". Perhaps "#cinclude"? The idea is obvious enough that it probably has occurred to others. Have any of you run across an implementation? What problems have come up with it? Or do you consider it trivial and thus would just be another instance of "creeping featurism" in the language? Your thoughts would be appreciated. joe korty uunet!modcomp!joe PS: Send email if you like; I'll be glad to correlate and summarize the responses.