Path: utzoo!utgpu!water!watmath!clyde!rutgers!im4u!woton!riddle From: riddle@woton.UUCP (Prentiss Riddle ) Newsgroups: comp.lang.c Subject: Re: Making re-#includes harmless--a simple solution? Summary: But sometimes you *want* to #include a file multiple times Message-ID: <1011@woton.UUCP> Date: 10 Dec 87 17:00:52 GMT References: <2000@bloom-beacon.MIT.EDU> Organization: Shriners Burns Institute, Galveston Lines: 16 Simply-Harmless: "Bob" newman@athena.mit.edu (Ron Newman) writes: > Why not change the semantics of "#include" to be: "if, while > processing the current .c source file, I have already included this > file once, then don't include it again"? But sometimes you *want* to #include a file multiple times. One example that comes to mind is the problem of generating essentially the same code for multiple types of objects. Redefine a few identifiers or macros before each #inclusion and you've got it. One example of a program that does this trick is c_config, posted to the net some time back by Steve Pemberton (steve@cwi.nl). --- Prentiss Riddle ("Aprendiz de todo, maestro de nada.") --- Opinions expressed are not necessarily those of Shriners Burns Institute. --- riddle@woton.UUCP {ihnp4,harvard}!ut-sally!im4u!woton!riddle