Boost logo

Boost Users :

From: Peter Koch Larsen (pkl_at_[hidden])
Date: 2005-08-15 16:10:12


Hi Thorsten

I must say that I agree with Kevin (and the gcc compiler) here. A C-style
cast is not only a const cast; it is a everything-cast... if the only
purpose is to cast away const, be clear and use a const cast. I can see no
compelling reason (except laziness) not to.

/Peter

>
> "Kevin Wheatley" <hxpro_at_[hidden]> wrote in message
> news:4300715B.ED49E94C_at_cinesite.co.uk...
>> I had some code that with 1.32 compiled fine when compiled with
>> warnings as errors, but now with 1.33 I get:
>
>> Compiled with gcc 3.2.3 under Linux,
>>
>> perhaps something like this is needed?
>
>> template< class Char >
>> inline Char* str_end( Char* s )
>> {
>> - return (Char*)str_end( s, s );
>> + return const_cast<Char*>(str_end( s, s ));
>
> what's the difference? A c-style cast is also a const-cast.
>
> -Thorsten
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net