[PATCH]: Change CONST_CAST macro to accept a TYPE argument

Paolo Bonzini bonzini@gnu.org
Mon Sep 3 08:06:00 GMT 2007


> 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';

This kind of bypassing the checks already happens e.g. in build_vl_exp_stat.

Paolo



More information about the Java-patches mailing list