Path: utzoo!mnetor!uunet!husc6!rutgers!ucla-cs!zen!ucbvax!cbosgd!pegasus!hansen From: hansen@pegasus.UUCP (Tony L. Hansen) Newsgroups: comp.lang.c Subject: Re: Making re-#includes harmless--a simple solution? Message-ID: <3061@pegasus.UUCP> Date: 21 Dec 87 15:12:22 GMT References: <2000@bloom-beacon.MIT.EDU> <385@doug.UUCP> Reply-To: hansen@pegasus.UUCP (XMPE40000-Tony L. Hansen;LZ 3B-315;6243) Organization: AT&T-IS Labs, Lincroft, NJ Lines: 21 Keywords: C, ANSI C, System V Summary: System V does not do this < From: tim@doug.UUCP (Tim J Ihde) < < In article <2000@bloom-beacon.MIT.EDU>, 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"? < < I don't know if this is in the ANSI definition of include or not, but this < is exactly how the latest version of cpp on System V works. It simply < remembers each include file that it has read and will ignore it if the same < file shows up again. This is definatly the way to go. (I hadn't seen anything else come back yet on the net refuting this.) The latest distributed System V version of CPP does NOT do this automatic checking for multiple #includes of a file. The author of the above article had installed nmake on his machine, which comes with its own version of CPP, but hadn't realized that CPP had changed. Tony Hansen ihnp4!pegasus!hansen, attmail!tony