Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!rice!sun-spots-request From: megatest!djones@decwrl.dec.com (Dave Jones) Newsgroups: comp.sys.sun Subject: Re: sun cc Keywords: SunOS Message-ID: <4993@brazos.Rice.edu> Date: 14 Feb 90 02:56:16 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 25 Approved: Sun-Spots@rice.edu X-Refs: Original: v9n22 X-Sun-Spots-Digest: Volume 9, Issue 41, message 13 From article <4662@brazos.Rice.edu>, by bobm@ee.rochester.edu (Bob Molyneaux): ... > Consider 2 source files each with the following declaration at the top > > static int tempvar; > > One may accertain the address of the variable tempvar declared in file B. > When B is compiled last, any assignment of tempvar in file A is stored in > the address allocated in file B. (ie. the two variables are but one.) I've never seen this happen, and can not make it happen now with little examples. I get two memory locations, just like I should: % nm a.out | grep tempvar 00020cb4 b _tempvar 00020cb8 b _tempvar When I run it, the program does the right thing. What you need to do is to get a small example program which messes up, post it _exactly_, along with the type of machine, software version number, etc... If there is a problem, it is probably in the linker "ld", not in cc, but I suspect you are overlooking a programming mistake.