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++)
Andreas Schwab <schwab@suse.de> writes:
| Gabriel Dos Reis <gdr@cs.tamu.edu> writes:
|
| > Look at the current implementation of build_string
| >
| > tree
| > build_string (int len, const char *str)
| > {
| > tree s;
| > size_t length;
| [...]
| > s = ggc_alloc_tree (length);
| >
| [...]
| >
| > return s;
| > }
| >
| > The lvalue "s" is just nonmodifiable aoocording to the above language.
|
| (You probably mean "*s", since s is not const qualified).
Yes.
| But the object
| returned by ggc_alloc_tree _is_ modfiable. And this is what matters here.
| Just like
|
| const int *foo() { return malloc (sizeof (int)); }
|
| returns a pointer to a modfiable object, although the lvalue *foo() isn't.
You left too much out of my message. As I'm in hurry to get
something else done, I'll return back to you later, but in the
meantime, let me point out one thing:
Assume you can modify *s, then you still don't get anything useful
from Geoff's change, because the string could be modified anyway.
Therefore the "const" is there only to damage work done in the
direction of being able to compile GCC source with a C++ compiler.
-- Gaby