Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!edcastle!aiai!aipna!cstr!rjc From: rjc@cstr.ed.ac.uk (Richard Caley) Newsgroups: comp.lang.c Subject: Re: Correct or Not or Old-fashioned or Bug Message-ID: Date: 23 May 91 18:18:18 GMT References: Sender: news@aipna.ed.ac.uk Distribution: comp.lang.c Organization: Centre for Speech Technology Research Lines: 40 In-reply-to: zhoumi@nff.ncl.omron.co.jp's message of 23 May 91 01:25:19 GMT In article , Zhou Mi (zm) writes: zm> But, there are so many conflicting answers that I feel really zm> confusion. Can anyone give me a proper conclusion or answer ?? Me too, so I caved in and asked for divine guidence. From K&R, K&R-II and Plaughter and Brodie... The Old testament, the book of Reference, chapter 11, verse 2: ``The apearence of the extern keyword in an external definition indicates that storage for the identifiers being declared will be allocated in another file. Thus in a multi-file program, an external data definition without the extern specifier must appear in exactly one of the files.'' The New Testament, the book of Reference, chapter 10, verse 2: ``An external object declaration that does not have an initialiser, and does not contain the extern specifier, is a tentative definition. [...] If no definition for the object appears _in_the_translation_unit_, all its tentative definitions become a single definition with initialiser 0.'' [emphasis mine]. The Commentaries: ``If a data object declaration is a tentative definition and you write no definition for the same object later in the translation unit, then the translater allocates storage for the data object at the end of the translation unit.'' Someone else will have to do the Tablets of Stone. TNT adds a comment that the multi-file version of the rule is recognised by the standard as a common extension. -- rjc@cstr.ed.ac.uk It was news to me too, too long on Unix.