Tool to help reduce multiple #include's

Rich Salz rsalz at uunet.uu.net
Sat Oct 28 03:22:08 AEST 1989


The following was just posted in comp.sources.unix (write to
unix-sources-request at brl.mil if you don't get Usenet), FYI.

    From: rsalz at uunet.uu.net (Rich Salz)
    Newsgroups: comp.sources.unix
    Subject: v20i080:  Modify files to help remove multiple #include's
    Message-ID: <2096 at papaya.bbn.com>
    Date: 27 Oct 89 17:19:39 GMT
    Lines: 273
    Approved: rsalz at uunet.UU.NET

    Submitted-by: "Fred J. E. Long" <flong at sdsu.edu>
    Posting-number: Volume 20, Issue 80
    Archive-name: multi-include

    [  I believe this is a solution in search of a problem, but the ongoing
       discussion in comp.lang.c and comp.lang.c++ indicates that lots of
       people are interested in something like this.  /r$ ]

    Here is a very simple program I wrote after seeing the recent
    controversy in comp.lang.c++ over "multiple inclusion".  It just puts
	    #if FILENAME != 0
	    #define FILENAME 0
    at the top of each file (if the -i option is specified) and puts
	    #endif /* FILENAME */
    at the bottom.  The -o option does likewise, but it puts the macros around
    all the #includes:
	    #include "foobar.h"
    goes to:
	    #ifndef FOOBAR_H
	    #define FOOBAR_H 1
	    #include "foobar.h"
	    #endif /* FOOBAR_H */
-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.lang.c mailing list