$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] warning policy issue
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-11-26 18:33:17
Paul A. Bristow wrote:
>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Robert Ramey
>> Sent: Thursday, November 26, 2009 5:32 PM
>> To: boost_at_[hidden]
>> Subject: [boost] warning policy issue
>>
>> On page
>>
> https://svn.boost.org/trac/boost/wiki/Guidelines/MaintenanceGuidelines#warnings
>>
>> 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