Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-01-17 20:46:42

On Tue, 17 Jan 2006 12:08:06 -0600, Dale Wilson wrote
> Hi, (possible duplicate, but I think the original was rejected 'cause of a
> mail alias. If not, please forgive the noise.)
> I'm using boost 1.32 posix_time in some code that is intended to be portable
> (MS VC7.1 / Solaris gcc 3.3.1 / RHLinux gcc 3.3.1).
> When I build with VC 7.1.3088 on Windows XP Pro SP2 get warnings about
>integer trunction (see below).
> I can duplicate it by compiling a cpp file containing a single line:
> #include "boost/date_time/posix_time/posix_time.hpp"
> and I can work around it by:
> #ifdef _MSC_VER
> #pragma warning(push)
> #pragma warning(disable:4244) // boost/posix_time has truncation warnings
> #endif // _MSC_VER
> #include "boost/date_time/posix_time/posix_time.hpp" //include all types
plus i/o
> #ifdef _MSC_VER
> #pragma warning(pop)
> #endif // _MSC_VER
> but this might hide real problems (or this might *BE* a real problem -- I
>haven't really looked into the difference between a
>boost::date_time::counted_time_rep<config>::int_type. and a

> Suggestions?

We've looked at and addressed a number of these warnings in 1.33 and non of
them would ever create a run-time problem. They tended to be places where the
number of months was extracted into a short, but b/c of context it was assured
that the value would be within the range of a short -- but the compiler
couldn't really deduce that and hence the warnings. Bottom line, I expect
your warning disable will be safe.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at