This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]