This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Thoughts on "const tree" and "const rtx"?


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




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