Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.ARPA (Doug Gwyn )
Newsgroups: comp.lang.c
Subject: Re: Making re-#includes harmless--a simple solution?
Message-ID: <6839@brl-smoke.ARPA>
Date: 15 Dec 87 08:04:11 GMT
References: <13395@think.UUCP> <339@pvab.UUCP>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) )
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 19

In article <339@pvab.UUCP> robert@pvab.UUCP (Robert Claeson) writes:
-In article <13395@think.UUCP> rlk@THINK.COM writes:
->1)  The same file may have multiple names (symlinks and/or hard
->links).  How do you KNOW whether a file has been included?  The only
->way is by defining an attribute that only that file will have.  The
->easiest way to do this (aside from checking device/inumbers, which is
->not portable and may not work in some bizarre cases, or other system
->dependent hacks) is to #define a unique name.
-
-How can you be sure that the name you choose is unique, especially if
-you use links or symlinks?

That was rlk's whole point; only the file contents (in particular
the unique #define) can be IMMUNE to links and symlinks.

#ifndef UNIQUE_SYMBOL
#define UNIQUE_SYMBOL
/* useful definitions & declarations here */
#endif