Path: utzoo!utgpu!water!watmath!dalcs!garfield!john13 From: john13@garfield.UUCP (John Russell) Newsgroups: comp.lang.c Subject: Re: extern Keywords: extern Message-ID: <4441@garfield.UUCP> Date: 25 Jan 88 04:42:51 GMT References: <17428@topaz.rutgers.edu> <7123@brl-smoke.ARPA> <4405@garfield.UUCP> <7150@brl-smoke.ARPA> <4694@ihlpg.ATT.COM> Reply-To: john13@garfield.UUCP (John Russell) Distribution: na Organization: Memorial University of Newfoundland, St. John's Lines: 31 In article <4694@ihlpg.ATT.COM> tainter@ihlpg.ATT.COM (Tainter) writes: >> In article <4405@garfield.UUCP> john13@garfield.UUCP (John Russell) writes: >> -file 1 - >> int fou; [ ^^^ this is a combination intentional typo and French pun ] >> -file 2 - >> extern int foo; >> foo = 1; > >I assume this last line was supposed to be a static initialization. Oops, no, not a static initialization but one somewhere later on, within a function. The point I wanted to make was that even if the variable is _never_ declared except as extern, the compiler may in fact allocate it for you and let you refer to it without complaining. The code even works properly. However if you had 100 references to the variable "long_variable_name" in file1, and 100 references to the variable "long_varaible_name" (sic!) in file2, you could easily be operating under the assumption that they were the same variable if you were using extern. John -- "You are lying scum!" -- member of Parliament James Fulton was expelled for saying this to Canadian Prime Minister Brian Mulroney; use of the word "lying" was deemed unparliamentary, although the "scum" was acceptable