[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] defined twice error commented out
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] defined twice error commented out |
Date: |
Fri, 30 Oct 2015 16:45:42 +0100 (CET) |
User-agent: |
Alpine 2.20 (LSU 67 2015-01-07) |
Hi,
On Thu, 29 Oct 2015, grischka wrote:
> Michael Matz wrote:
> > ... In C it's not allowed to have two definitions of the same non-static
> > symbol, simple as that. It's not only for when initialized with different
> > values or the like; it's undefined no matter what.
>
> Maybe it isn't that clear. See below from the c99 draft, in particular
> the word "tentative".
Yes, but multiple tentative definitions are only allowed inside one
translation unit, where they then collapse into one definition equivalent
to one initialized by 0. When multiple such translation units are
involved then 6.9#5 comes into play:
5 An external definition is an external declaration that is also a
definition of a function (other than an inline definition) or an
object. If an identifier declared with external linkage is used in an
expression (other than as part of the operand of a sizeof operator
whose result is an integer constant), somewhere in the entire program
there shall be exactly one external definition for the identifier;
otherwise, there shall be no more than one.
In particular exactly one definition if the identifier is used; and not
more than one when it's unused.
Ciao,
Michael.
- Re: [Tinycc-devel] defined twice error commented out, (continued)
- Re: [Tinycc-devel] defined twice error commented out, Stephan Beal, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Sergey Korshunoff, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Stephan Beal, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Sergey Korshunoff, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Stephan Beal, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, grischka, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Sergey Korshunoff, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Sergey Korshunoff, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, Michael Matz, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out, grischka, 2015/10/29
- Re: [Tinycc-devel] defined twice error commented out,
Michael Matz <=
- Re: [Tinycc-devel] defined twice error commented out, Michael Matz, 2015/10/29