compiler warnings using date_time library on VS.NET 2003

I am using VS.NET 2003 and have a simple program which merely includes the Boost date_time library. When compiling, I get 4 warning messages about unsafe conversions. Is there some compiler setting that I can change to get rid of this warning? Shouldn't I be able to include a Boost library without getting warnings? Thanks!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // main.cpp
#include "boost/date_time/posix_time/posix_time.hpp" void main() { }
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
------ Build started: Project: boost, Configuration: Debug Win32 ------ Compiling... main.cpp c:\lib\boost_1_32_0\boost\date_time\posix_time\conversion.hpp(27) : warning C4244: 'argument' : conversion from 'time_t' to 'long', possible loss of data c:\lib\boost_1_32_0\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:\lib\boost_1_32_0\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:\lib\boost_1_32_0\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:\lib\boost_1_32_0\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:\lib\boost_1_32_0\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:\lib\boost_1_32_0\boost\date_time\time_parsing.hpp(81) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data c:\lib\boost_1_32_0\boost\date_time\posix_time\time_parsers.hpp(27) : see reference to function template instantiation 'time_duration boost::date_time::parse_delimited_time_duration<boost::posix_time::time_duration>(const std::string &)' being compiled with [ time_duration=boost::posix_time::time_duration ] c:\lib\boost_1_32_0\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:\lib\boost_1_32_0\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:\lib\boost_1_32_0\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> ]

On Thu, 21 Jul 2005 18:38:16 -0600, Sean Rohead wrote
I am using VS.NET 2003 and have a simple program which merely includes the Boost date_time library. When compiling, I get 4 warning messages about unsafe conversions.
Sigh...
Is there some compiler setting that I can change to get rid of this warning?
Yes, but you shouldn't have to...
Shouldn't I be able to include a Boost library without getting warnings?
Yes. We have a basic issue with the testing platform right now that does not allow us to see compiler warnings unless the compilation fails. Compilers vary widely in the warnings they produce so even though date-time compiles fine with -Wall using gcc (my primary compiler) these kind of problems can crop up. Anyway, I'll look into these, but it will probably have to wait for 1.34. Jef

On 7/21/05, Jeff Garland <jeff@crystalclearsoftware.com> wrote:
On Thu, 21 Jul 2005 18:38:16 -0600, Sean Rohead wrote
I am using VS.NET 2003 and have a simple program which merely includes the Boost date_time library. When compiling, I get 4 warning messages about unsafe conversions.
Sigh...
Is there some compiler setting that I can change to get rid of this warning?
Yes, but you shouldn't have to...
Shouldn't I be able to include a Boost library without getting warnings?
Yes. We have a basic issue with the testing platform right now that does not allow us to see compiler warnings unless the compilation fails. Compilers vary widely in the warnings they produce so even though date-time compiles fine with -Wall using gcc (my primary compiler) these kind of problems can crop up. Anyway, I'll look into these, but it will probably have to wait for 1.34.
Is a cast really something that needs to be held back until the next release? If so, I don't think anyone would object to temporarily wrapping the header in #pragmas for VC++. It certainly is annoying to have to do this stuff every time I want to include the header. #pragma warning(push) #pragma warning(disable:4244) // stuff here #pragma warning(pop)
Jef _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Cory Nelson http://www.int64.org

"Sean Rohead" <sean.rohead@nextpage.com> wrote in message news:dbpf56$hig$1@sea.gmane.org...
I am using VS.NET 2003 and have a simple program which merely includes the Boost date_time library. When compiling, I get 4 warning messages about unsafe conversions. Is there some compiler setting that I can change to get rid of this warning? Shouldn't I be able to include a Boost library without getting warnings?
Thanks!
Could you please tell me, what warning level are you using and are you using boost 1.32 or current cvs? Thanks, Bart
participants (4)
-
Bart
-
Cory Nelson
-
Jeff Garland
-
Sean Rohead