This is the mail archive of the mailing list for the libstdc++ 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] PR11504: -Wcast-qual and general constness issues with stl_tree.h

On Thu, Jul 24, 2003 at 09:48:07PM +0200, Gawain Bolton wrote:

>   1. I do not like the lack of symmetry with the casts for const vs.
>      non-const functions.
>      Non-const versions often require a reinterpret_cast whereas const
>      versions can use static_cast.

Can't you combine const_cast and static_cast to achieve the same thing?
As in

>   2. The "const" typedefs.
>      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.

Now repeat that six times as fast as you can!  :-)


"Once, during Prohibition, I was forced to live for days on nothing but 
 food and water."
	- W.C. Fields

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