Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: extern Keywords: extern Message-ID: <7150@brl-smoke.ARPA> Date: 21 Jan 88 15:55:29 GMT References: <17428@topaz.rutgers.edu> <7123@brl-smoke.ARPA> <4405@garfield.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: na Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <4405@garfield.UUCP> john13@garfield.UUCP (John Russell) writes: -In article <7123@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: -] Not quite either. There are two possible methods of implementation -] of extern data in C, but the model you should think of is: If it -] says "extern", it is a reference to something allocated elsewhere; -That is the way you should think about it, but if you do something like this: -file 1 - -int fou; [I assume "foo" was intended] -file 2 - -extern int foo; -foo = 1; -then at least some compilers will run this properly (no warnings even). PLEASE don't do this. A compiler is not obliged to make this example "work". That is why you should think the way I said; C compilers are obliged to always make that approach work right.