[Boost-bugs] [Boost C++ Libraries] #12333: boost/algorithm/hex.hpp: warning C4244: 'return': conversion from 'unsigned int' to 'unsigned char'

Subject: [Boost-bugs] [Boost C++ Libraries] #12333: boost/algorithm/hex.hpp: warning C4244: 'return': conversion from 'unsigned int' to 'unsigned char'
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-18 18:34:25


#12333: boost/algorithm/hex.hpp: warning C4244: 'return': conversion from 'unsigned
int' to 'unsigned char'
-------------------------------+-----------------------
 Reporter: pravic <ehysta@…> | Owner: marshall
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: algorithm
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
-------------------------------+-----------------------
 â€¦ which is not surprise:


 {{{
     template <typename T>
     unsigned char hex_char_to_int ( T val ) {
         char c = static_cast<char> ( val );
         unsigned retval = 0; // <--
         // ...
         return retval; // <--
         }
 }}}

 Compiler output:
 {{{
 1>boost/algorithm/hex.hpp(74): warning C4244: 'return': conversion from
 'unsigned int' to 'unsigned char', possible loss of data
 1> boost/algorithm/hex.hpp(129): note: see reference to function template
 instantiation 'unsigned char
 boost::algorithm::detail::hex_char_to_int<char>(T)' being compiled
 1> with
 1> [
 1> T=char
 1> ]
 1> boost/algorithm/hex.hpp(196): note: see reference to function template
 instantiation 'unsigned char
 *boost::algorithm::detail::decode_one<InputIterator,OutputIterator,bool(__cdecl
 *)(Iterator,Iterator)>(InputIterator
 &,InputIterator,OutputIterator,EndPred)' being compiled
 1> with
 1> [
 1> InputIterator=const char *,
 1> OutputIterator=unsigned char *,
 1> Iterator=const char *,
 1> EndPred=bool (__cdecl *)(const char *,const char *)
 1> ]
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12333>
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