Compiling GCC With a C++ Compiler (g++)

Gabriel Dos Reis gdr@cs.tamu.edu
Wed Oct 13 13:29:00 GMT 2004


Ranjit Mathew <rmathew@gmail.com> writes:

| In this particular case, we can probably resolve this 
| issue by removing "const" from tree_string but adding
| "(const char *)" to the definition of TREE_STRING_POINTER
| so that for "properly behaving" clients of a STRING_CST,
| it is still a constant.

That is the immediat way I would solve this.  What we want to prevent
is accidental modification.  So the "(const char*)" belongs to the
accessor.  This tree_string is going to be put in a union where a
priori we do not know which is going to be accessed; so the
const cannot belong to the object.  However, we can make sure that
anybody who access that field have the illusion of non-modyfiability.

-- Gaby



More information about the Gcc mailing list