Boost logo

Boost Users :

From: Dale Wilson (wilson_d_at_[hidden])
Date: 2006-01-17 13:08:06


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
boost::date_time::gregorian_calendar_base<ymd_type_,date_int_type_>::date_int_type

Suggestions?

Dale

The warnings:

c:\Boost\include\boost-1_32\boost\date_time\time_system_counted.hpp(57)
: warning C4244: 'initializing' : conversion from
'boost::date_time::counted_time_rep<config>::int_type' to
'boost::date_time::gregorian_calendar_base<ymd_type_,date_int_type_>::date_int_type',
possible loss of data
       with
       [
           config=boost::posix_time::millisec_posix_time_system_config
       ]
       and
       [
           ymd_type_=boost::gregorian::greg_year_month_day,
           date_int_type_=boost::date_time::int_adapter<unsigned
long>::int_type
       ]
       
c:\Boost\include\boost-1_32\boost\date_time\time_system_counted.hpp(52)
: while compiling class-template member function
'boost::date_time::counted_time_rep<config>::date_type
boost::date_time::counted_time_rep<config>::date(void) const'
       with
       [
           config=boost::posix_time::millisec_posix_time_system_config
       ]
       
c:\Boost\include\boost-1_32\boost\date_time\time_system_counted.hpp(111)
: see reference to class template instantiation
'boost::date_time::counted_time_rep<config>' being compiled
       with
       [
           config=boost::posix_time::millisec_posix_time_system_config
       ]
       c:\Boost\include\boost-1_32\boost\date_time\time.hpp(52) : see
reference to class template instantiation
'boost::date_time::counted_time_system<time_rep>' being compiled
       with
       [
           time_rep=boost::posix_time::int64_time_rep
       ]
       
c:\Boost\include\boost-1_32\boost\date_time\posix_time\ptime.hpp(32) :
see reference to class template instantiation
'boost::date_time::base_time<T,time_system>' being compiled
       with
       [
           T=boost::posix_time::ptime,
           time_system=boost::posix_time::posix_time_system
       ]
c:\Boost\include\boost-1_32\boost\date_time\date_parsing.hpp(211) :
warning C4244: 'argument' : conversion from
'std::allocator<_Ty>::value_type' to 'char', possible loss of data
       with
       [
           _Ty=wchar_t
       ]
       c:\Boost\include\boost-1_32\boost\date_time\date_parsing.hpp(253)
: see reference to function template instantiation 'date_type
boost::date_time::from_stream_type<date_type,std::basic_string<_Elem,_Traits,_Ax>::iterator>(iterator_type
&,iterator_type &,wchar_t)' being compiled
       with
       [
           date_type=boost::gregorian::date,
           _Elem=wchar_t,
           _Traits=std::char_traits<wchar_t>,
           _Ax=std::allocator<wchar_t>,
           
iterator_type=std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>::iterator

       ]
       
c:\Boost\include\boost-1_32\boost\date_time\gregorian\parsers.hpp(78) :
see reference to function template instantiation
'boost::date_time::period<point_rep,duration_rep>
boost::date_time::from_simple_string_type<boost::gregorian::date,wchar_t>(const
std::basic_string<_Elem,_Traits,_Ax> &)' being compiled
       with
       [
           point_rep=boost::gregorian::date,
           duration_rep=boost::gregorian::date_duration,
           _Elem=wchar_t,
           _Traits=std::char_traits<wchar_t>,
           _Ax=std::allocator<wchar_t>
       ]

-- 
-----------------------------------------------------
  Dale Wilson, Senior Software Engineer
  Object Computing, Inc. (OCI)
  http://www.ociweb.com/  http://www.theaceorb.com/
----------------------------------------------------


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