Opened 13 months ago

Closed 8 months ago

#13373 closed Bugs (fixed)

Warning in Boost.Log or Boost.DateTime with VS2017

Reported by: christof.krueger@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.65.0 Severity: Problem
Keywords: Cc:


I'm getting the following compiler warning while compiling my code with VS2017 on a Windows 7 machine:

C:\Users\<...>\boost-1_65_1\boost/log/support/date_time.hpp(66): warning C4244: '=': conversion from '__int64' to 'uint32_t', possible loss of data
C:\Users\<...>\boost-1_65_1\boost/log/support/date_time.hpp(67): warning C4244: '=': conversion from '__int64' to 'uint32_t', possible loss of data
C:\Users\<...>\boost-1_65_1\boost/log/support/date_time.hpp(68): warning C4244: '=': conversion from '__int64' to 'uint32_t', possible loss of data

I'm using a simple console log (boost::log::add_console_log(std::clog)) wich a formatter created like this:

namespace expr = boost::log::expressions;
auto fmtTimeStamp = expr::format_date_time<boost::posix_time::ptime>("TimeStamp", %Y-%m-%d %H:%M:%S.%f");
boost::log::formatter logFmt
    = expr::format("[%1%] [%2%] {%3%} <%4%> %5%")
        % fmtTimeStamp
        % expr::attr<my_severity_level_type>("Severity")
        % expr::attr<std::string>("ThreadName").or_default(std::string("?"))
        % expr::attr<std::string>("Channel").or_default(std::string("?"))
        % expr::message;

Is there anything I could do about? Or is it something that should be fixed within Boost? I'd like to have warning-free code wherever possible, of course.

Change History (2)

comment:1 Changed 8 months ago by John Maddock

Component: Nonelog
Owner: set to Andrey Semashev

comment:2 Changed 8 months ago by Andrey Semashev

Resolution: fixed
Status: newclosed

I believe, this has been fixed in, released in Boost 1.66.

Note: See TracTickets for help on using tickets.