This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Thoughts on "const tree" and "const rtx"?
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 07 Nov 2003 17:29:48 +0100
- Subject: Re: Thoughts on "const tree" and "const rtx"?
- Organization: Integrable Solutions
- References: <Pine.LNX.4.44.0311070729530.32275-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> writes:
| I apologise if this has been discussed numerous times before and
| I've managed to miss the thread each time its been brought up.
|
| Is there any reason why GCC doesn't make far more use of "const tree"
| and "const rtx" in function parameter lists to mark the underlying
| data structure as immutable?
Given that tree is actually a typedef to a pointer, saying "const tree"
in a function parameter (or a variable definition) does not really
make the underlying (i.e. pointee) data structrure immutable. It just
says that the function parameter itself (i.e. the pointer) may not
be modified -- and in a prototype declaration, it has no semantic
effect. So, "const tree" appears to me as a near-to-useless
complication. If however, you suggest "const tree_common *" or
"const_tree", then I may say, that is probably an idea that worths
trying.
-- Gaby