Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site gumby.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxj!mhuxr!ulysses!allegra!mit-eddie!godot!harvard!seismo!uwvax!gumby!g-frank From: g-frank@gumby.UUCP Newsgroups: net.lang.c Subject: Re: Lattice/UNIX incompatibility Message-ID: <238@gumby.UUCP> Date: Tue, 1-Jan-85 14:48:32 EST Article-I.D.: gumby.238 Posted: Tue Jan 1 14:48:32 1985 Date-Received: Thu, 3-Jan-85 03:46:44 EST References: <6845@brl-tgr.ARPA> <1157@ut-ngp.UUCP> Organization: U of Wisconsin CS Dept Lines: 21 > >> 3. Every declaration of an external variable but > >> one must say 'extern'. > > > For any linker that supports FORTRAN, this restriction shows a lack of > > imagination on the part of the c compiler writers. Don't get me started > > on this; it's a favorite flame. > > Or, perhaps, just a desire for C to work correctly. K & R specify this > behavior and doing otherwise invites nonportable code. > -- I realize that it's normal under UNIX to be able to declare the same variable multiple times and count on the linker to resolve it to a single location. I also realize that it's convenient to do this because one might want to include such a declaration in a header file, to be read by all compilands of a particular program. Nonetheless, my common sense rebels. A particular variable "belongs" to a particular module, and is "external" to all other modules. Real languages enforce this restriction in a meaningful way (as does C++, I believe). There IS semantic meaning to where a variable is declared.