Correct or Not or Old-fashioned or Bug

Larry Jones scjones at thor.sdrc.com
Sat May 25 01:55:57 AEST 1991


In article <19804 at crdgw1.crd.ge.com>, volpe at 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 at sdrc.com             Path: uunet!sdrc!scjones
I won't eat any cereal that doesn't turn the milk purple. -- Calvin



More information about the Comp.lang.c mailing list