This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiling GCC With a C++ Compiler (g++)
On Tue, Oct 12, 2004 at 03:57:56PM -0700, Zack Weinberg wrote:
> Gabriel Dos Reis <gdr@cs.tamu.edu> writes:
>
> > Geoffrey Keating <geoffk@apple.com> writes:
> > | The 'const' is there to indicate that the string should not be changed
> > | once the STRING_CST is created;
> >
> > And how do you create it?
>
> By casting away the const, as is done in build_string. Or by
> constructing the data in memory before giving it the type with the
> const qualifier.
The normal creation process is to do the second approach of the ones
you listed. The difference is that for C++, that can only be done in one
particular place. Since member init-lists aren't available for STRING_CST,
we have to cast away the const in build_string -- which essentially plays
the role of a C++ constructor.
The const should stay; C is not C++, and the way in which write-once
constructs are created is just plain /different/ at the source level.
Until we can agree that we should be able to use C++ in the compiler, this
thrashing around trying to make the source acceptable in both languages
is just going to produce heat and noise.
> How else do you propose to enforce write-once semantics on a data
> structure that is, in fact, write-once? I am definitely with Geoff
> here - this should be allowed (or, to rephrase, if C++ has no
> construct which allows what we want to do here, that is a language
> deficiency).
It does, but only for member functions. So we can't go there.
Phil
--
Behind everything some further thing is found, forever; thus the tree behind
the bird, stone beneath soil, the sun behind Urth. Behind our efforts, let
there be found our efforts.
- Ascian saying, as related by Loyal to the Group of Seventeen