This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: zack's todo list
- To: Florian dot Weimer at RUS dot Uni-Stuttgart dot DE, zackw at Stanford dot EDU
- Subject: Re: zack's todo list
- From: Mike Stump <mrs at windriver dot com>
- Date: Wed, 15 Nov 2000 18:25:01 -0800 (PST)
- Cc: gcc at gcc dot gnu dot org
> To: "Zack Weinberg" <zackw@Stanford.EDU>
> Cc: gcc@gcc.gnu.org
> From: Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>
> Date: 15 Nov 2000 14:05:55 +0100
> > I want to see chapter and verse that says we can't emit
> >
> > a:
> > b:
> > .string "blah"
> >
> > for my original C fragment, and
> If we can agree that this is an example of "linkage", the answer is,
> quit obviously: we can't (see footnote 21 in 6.2.2: "There is no
> linkage between different identifiers.").
Ah, but this isn't quite enough. You need a notion of uniqueness.
The sharing language in the standard isn't necessary to permit
sharing. You get sharing anyways. To prohibit sharing the standard
would have to say something like, the address of each character
(including the terminating '\0' character) in a string literal shall
be unique with respect to every other object and each character in all
string literals in a program. The standard fails to make that
guarantee, as I read it.
Now, in the case at hand, while the standard doesn't live up to
mathematical rigor, we can see that it means for objects denoated by
identifiers that are not linked to indeed be unique:
6.1.2.2 Linkages of identifiers
Identifiers with no linkage denote unique entities.
So, this would seem to indicate what their thinking was. It is the
words `unique entity' that seems to mandates the requirement of unique
address, I think.
> -- for an object, causes storage to be reserved for that
> object;
> The second declaration (or the first, depending on your view) does
> not "cause storage to be reserved for that object", thus violating
> the standard.
The phrase causes storage to be reserved, doesn't mean that it causes
storage to be reserved. This is a fundamental misunderstanding of
Standadeze. It is only that one isn't allowed to notice that storage
isn't reserved, but if you don't, or cannot, then you cannot observe
it, and if you cannot observe it, it is rather meaningless. For
example, in the below program, it is perfectly reasonable to not
allocate any storage for a or b, or to assign exactly one int word to
hold both the value of and the value of b.
const int a = 42;
const int b = 42;
main() {
printf("%d", a);
}
Having said that, this doesn't say anything about any other program.