Re: [Boost-users] [BULK] Re: [range] From 1.33.0 gives new warning vs 1.32
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Thorsten Ottosen Sent: Monday, August 15, 2005 11:17 AM To: boost-users@lists.boost.org Subject: [BULK] Re: [Boost-users] [range] From 1.33.0 gives new warning vs 1.32 Importance: Low
"Kevin Wheatley"
wrote in message news:4300715B.ED49E94C@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
(str_end( s, s )); what's the difference? A c-style cast is also a const-cast.
You didn't just say that.
perhaps something like this is needed?
template< class Char > inline Char* str_end( Char* s ) { - return (Char*)str_end( s, s ); + return const_cast
(str_end( s, s )); what's the difference? A c-style cast is also a const-cast.
You didn't just say that.
Apparently I did. What's the difference in the generated object code? -Thorsten
"Thorsten Ottosen"
perhaps something like this is needed?
template< class Char > inline Char* str_end( Char* s ) { - return (Char*)str_end( s, s ); + return const_cast
(str_end( s, s )); what's the difference? A c-style cast is also a const-cast.
You didn't just say that.
Apparently I did.
I must admit I was surprised, too.
What's the difference in the generated object code?
Thorsten, the difference is in fragility over time with maintenance. That's why the compiler issues the warning. Any decent beginner's book on C++ will advise you to eschew all casts, and prefer the new-style ones. Do you really need to have the fundamentals of good C++ programming practice explained? Incidentally, if you find that the proper C++ construct is "less portable. somehow." you should use BOOST_WORKAROUND to isolate the compiler for which it fails to work, if only so that the reason for the workaround is documented. -- Dave Abrahams Boost Consulting www.boost-consulting.com
"David Abrahams"
"Thorsten Ottosen"
writes:
What's the difference in the generated object code?
Thorsten, the difference is in fragility over time with maintenance. That's why the compiler issues the warning. Any decent beginner's book on C++ will advise you to eschew all casts, and prefer the new-style ones. Do you really need to have the fundamentals of good C++ programming practice explained?
no. I always use const_cast in my own code. so that is why I believe it might be there for a reason.
Incidentally, if you find that the proper C++ construct is "less portable. somehow." you should use BOOST_WORKAROUND to isolate the compiler for which it fails to work, if only so that the reason for the workaround is documented.
yes, in a perfect world. I can change it and then we can see if it breaks anything. -Thorsten
"Thorsten Ottosen"
"David Abrahams"
wrote in message news:uk6im9880.fsf@boost-consulting.com... "Thorsten Ottosen"
writes: What's the difference in the generated object code?
Thorsten, the difference is in fragility over time with maintenance. That's why the compiler issues the warning. Any decent beginner's book on C++ will advise you to eschew all casts, and prefer the new-style ones. Do you really need to have the fundamentals of good C++ programming practice explained?
no. I always use const_cast in my own code. so that is why I believe it might be there for a reason.
Incidentally, if you find that the proper C++ construct is "less portable. somehow." you should use BOOST_WORKAROUND to isolate the compiler for which it fails to work, if only so that the reason for the workaround is documented.
yes, in a perfect world.
?? It doesn't take much more effort than changing the code to use a C-style cast.
I can change it and then we can see if it breaks anything.
Sounds good to me. -- Dave Abrahams Boost Consulting www.boost-consulting.com
"David Abrahams"
"Thorsten Ottosen"
writes:
I can change it and then we can see if it breaks anything.
Sounds good to me.
maybe, but remember the code in question is deprecated and so is likely to disappear in1.34. -Thorsten
"Thorsten Ottosen"
"David Abrahams"
wrote in message news:ubr3xis1s.fsf@boost-consulting.com... "Thorsten Ottosen"
writes: I can change it and then we can see if it breaks anything.
Sounds good to me.
maybe, but remember the code in question is deprecated and so is likely to disappear in1.34.
Maybe it doesn't matter then. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
David Abrahams
-
Sohail Somani
-
Thorsten Ottosen