Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!cadnetix.COM!cadnetix!pem
From: pem@cadnetix.COM (Paul Meyer)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Shadow of "shadow" (Think C question)
Message-ID: <9670@cadnetix.COM>
Date: 28 Sep 89 18:04:49 GMT
References: <14784@netnews.upenn.edu>
Sender: news@cadnetix.COM
Reply-To: pem@cadnetix.COM (Paul Meyer)
Organization: Cadnetix Corp.,  Boulder, CO
Lines: 46

In article <14784@netnews.upenn.edu> hvs@pender (H.V. Sorensen) writes:
>"shadow" for an integer variable. TC complains about an "illegal
>re-decleration of variable" or something like that. To reproduce the problem

>perfectly. Are there reserved words in TC that I am not aware of? If so are
>there any other "reserved" words I should be aware of? Anybody out there with
>an explanation?

	I have one.  No, TC doesn't reserve any words, but it does have
precompiled headers.  The standard precompiled stuff includes all the Mac
Toolbox stuff that a normal (or even moderately-advanced) Mac application
needs.  Among the precompiled files is the QuickDraw includes (I think
that's QuickDraw.h), which of course #defines "shadow" as a bit-mask value
for the text style type.  (In Pascal, you would get an error because the
identifier is already used in an enumerated type...).

	If you really don't plan to do Mac stuff with TC, you can make
your own precompiled header that doesn't do this; you can even replace
it with precompiling the ANSI library headers.  The stuff on how to do
this is in the TC manual, but I'll attempt to summarize below.  (I just
set up stuff to swap MacHeaders's myself recently, when working on NetHack
for my Mac BBS.)

	TC looks for a file called MacHeaders in the folder with the TC
application, and preloads it before every source file.  This is the only
form of header precompilation--you precompile one header file, and name
the output "MacHeaders" in the TC folder.  I suggest that the first thing
you do is copy the old MacHeaders so you can switch back to it to do Mac
things.  Then take a look at the structure of the file "Mac #includes.h",
in the TC folder, which is the source for the standard MacHeaders.  It's
basically a normal .h file that #includes all sorts of files from the
Mac #includes directory.  Now make up your own file that just includes all
the ANSI include files you commonly want.  While viewing it in TC, choose
"precompile" off the (I think) Project menu.  Store the output as something
like "ANSI MacHeaders" replace the original MacHeaders with a copy of ANSI
MacHeaders to run in non-Mac mode, and replace MacHeaders with a copy of
the saved original to go back to Mac mode.

	Alternatively, you could just patrol your code for uses of things
#defined in the Mac stuff, and carefully #undefine them before using the
words, but you would have to know what to look for (be familiar with Inside
Mac).
Paul Meyer                      pem@cadnetix.COM
Daisy/Cadnetix Inc. (DAZIX)	{uunet,boulder}!cadnetix!pem
5775 Flatirons Pkwy.            GEnie P.MEYER
Boulder, CO 80301               (303)444-8075x277