[Patch] PR11504: -Wcast-qual and general constness issues with stl_tree.h

Jonathan Wakely cow@compsoc.man.ac.uk
Mon Jul 28 08:57:00 GMT 2003


On Sat, Jul 26, 2003 at 04:02:23PM +0200, Gawain Bolton wrote:

> >>    Why do I have to define "const" versions of the typedefs?
> >>    If I have "typedef _Rb_tree_node* _Link_type;" then why can't I
> >>    use "const _Link_type" instead of having to define an explicit
> >>    const typedef like "typedef const _Rb_tree_node* _const_Link_type;"?
> >>   
> >>
> >
> >Because "const _Link_type" is the same as "_Link_type const" which is
> >"_Rb_tree_node* const" which is a const-pointer to a non-const-node,
> >not a pointer to a const-node.
> >
> Yes this is what I was seeing...   I just thought it strange that 
> "const" was being added afterwards when it was put before _Link_type...  
> Guess you'll have to tell me what you're smoking if this seems perfectly 
> clear to you!

I've been smoking FAQ

http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.5

and the following entries from 18.6 to 18.9

"const A" and "A const" are the same, whether A is a "real" type or a
typedef for something more complex such as "int const * const * const" 

jon


-- 
-><- IO ERIS IO ERIS ERIS -><-



More information about the Libstdc++ mailing list