Boost logo

Boost Users :

Subject: [Boost-users] Newbie Question
From: Walker.Kyle (Kyle.Walker_at_[hidden])
Date: 2013-01-11 17:46:18


It appears the following code has a warning detected by GCC4.7.2:
/boost/include/boost-1_52/boost/property_tree/detail/ptree_utils.hpp: In instantiation of 'std::string boost::property_tree::detail::narrow(const Ch*) [with Ch = wchar_t; std::string = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]':
/boost/include/boost-1_52/boost/property_tree/string_path.hpp:64:36: required from here
/boost/include/boost-1_52/boost/property_tree/detail/ptree_utils.hpp:76:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

boost-1_52\boost\property_tree\detail\ptree_utils.hpp (Starting line 70):
    template<class Ch>
    std::string narrow(const Ch *text)
    {
        std::string result;
        while (*text)
        {
            if (*text < 0 || *text > (std::numeric_limits<char>::max)())

Shouldn't it be:
    template<class Ch>
    std::string narrow(const Ch *text)
    {
        std::string result;
        while (*text)
        {
            if (*text < 0 || *text > (std::numeric_limits<Ch>::max)())

Code to reproduce this warning (just the include):
#include <boost/property_tree/ptree.hpp>



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