
Paul A. Bristow wrote:
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: Thursday, November 26, 2009 5:32 PM To: boost@lists.boost.org Subject: [boost] warning policy issue
On page
https://svn.boost.org/trac/boost/wiki/Guidelines/MaintenanceGuidelines#warni...
it's suggested that the following warning at level 4 can be eliminated with a static cast
warning C4244: 'argument' : conversion from <type1> to <type2> possible loss of data
I've found this not to be true at least with msvc 7.1
With MVSC Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM Microsoft .NET Framework Version 3.5 SP1
if I write
long x = 1234567890; short y = x;
I get a c4244 warning, but adding static_cast
long x = 1234567890; short y = static_cast<short>(x);
I don't get a warning (even if I don't get the value I might be expecting ;-)
My recollection (dim!) is that 7.1 works the same.
Are you quite sure you are casting to the right type?
I am. Are you quite sure that you're running at warning level 4? It doesn't occur at lower warning levels. Robert Ramey