Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!sdrc!thor!scjones From: scjones@thor.sdrc.com (Larry Jones) Newsgroups: comp.lang.c Subject: Re: Correct or Not or Old-fashioned or Bug Message-ID: <164@thor.sdrc.com> Date: 24 May 91 15:55:57 GMT References: <19804@crdgw1.crd.ge.com> Distribution: comp.lang.c Organization: SDRC, Cincinnati Lines: 17 In article <19804@crdgw1.crd.ge.com>, volpe@camelback.crd.ge.com (Christopher R Volpe) writes: > I think so far I have seen about 3 or 4 wrong answers to this question, such > as the above. There is nothing wrong with the referenced code as far as > the Standard is concerned. There are not multiple definitions of i, because > none of those *tentative* definitions has an initializer. In such a > situation, all tentative definitions are treated as a single definition > with initializer 0. (See A10.2 in K&R2 for an explanation) Not so. WITHIN A SINGLE SOURCE FILE, multiple tentative definitions are treated as a single definition, but the cited example had them scattered across multiple files. In this case, each file would end up with a definition and the linker is justified in complaining about it. ---- Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070 Domain: scjones@sdrc.com Path: uunet!sdrc!scjones I won't eat any cereal that doesn't turn the milk purple. -- Calvin