This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Change CONST_CAST macro to accept a TYPE argument
On Mon, 3 Sep 2007, Paolo Bonzini wrote:
>
> > So you couldn't issue the above statement because TREE_STRING_POINTER's
> > are not generally writable. Here, we know that it is safe because we just
> > allocated the space for it a few lines above.
> >
> > In order to write to it, you must cast away the const-ness, but doing so
> > prompts warnings from -Wcast-qual, hence the need for the CONST_CAST().
>
> Or, you can just write
>
> memcpy (s->string.str, str, len);
> s->string.str[len] = '\0';
>
Good idea thanks. After a make, to ensure there were no typos, (and
waiting 24 hours, per Richard G) that's what I checked in.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu