This is the mail archive of the libstdc++@gcc.gnu.org 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 withstl_tree.h


Jonathan Wakely wrote:

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 http://gcc.gnu.org/ml/libstdc++/2003-07/msg00297.html



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.

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!

Cheers,


Gawain


--
Gawain Bolton
Coignieres, France
PGP Info: Key server: http://wwwkeys.pgp.net
         Key id: 6EBEDEA6
         Fingerprint: 65C0 0030 21D1 7A01 546A  E7DB D60F 47E0 6EBE DEA6



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