Re: [Boost-bugs] [Boost C++ Libraries] #7679: unhex level 4 compile warning in visual studio

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7679: unhex level 4 compile warning in visual studio
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-04-07 13:36:30


#7679: unhex level 4 compile warning in visual studio
-------------------------------------+-----------------------
  Reporter: Gary Sanders <lex21@…> | Owner: marshall
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: algorithm
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords: unhex
-------------------------------------+-----------------------

Comment (by pmost@…):

 I'm still experiencing this bug in Boost 1.58.0 with Visual Studio 2013
 compiler warning level 4. The problematic code is in hex.hpp(74)
 {{{
     template <typename T>
     unsigned char hex_char_to_int ( T val ) {
         char c = static_cast<char> ( val );
         unsigned retval = 0;
         if ( c >= '0' && c <= '9' ) retval = c - '0';
         else if ( c >= 'A' && c <= 'F' ) retval = c - 'A' + 10;
         else if ( c >= 'a' && c <= 'f' ) retval = c - 'a' + 10;
         else BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c));
         return retval;
         }
 }}}

 If I define ''retval'' to be ''unsigned char'' then this warning goes
 away. Wouldn't this be the simplest solution?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7679#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC