Boost logo

Boost Users :

From: Clarke, Trevor (tclarke_at_[hidden])
Date: 2005-12-16 13:04:19


The problem is that the code does not state that it doesn't care if those bits disappear (via masking) so a warning is thrown stating that you are loosing data. Similar to compiler warnings if you do this:

int foo(123456789);
char bar = foo; // instead of bar = static_cast<char>(foo);

The difference is, the masking warning is a run time check which pops up a dialog every time the code executes and is thus not as easy to ignore as the compile warning.

------------------------------
Trevor R.H. Clarke
tclarke at ball com
Ball Aerospace & Technologies Corp

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Daryle Walker
Sent: Friday, December 16, 2005 12:38 PM
To: Boost Users mailing list
Subject: Re: [Boost-users] crc.hpp and visual studio run time checking

On 12/14/05 2:32 PM, "Clarke, Trevor" <tclarke_at_[hidden]> wrote:

> There are a few places in crc.hpp where the following happens:
> static value_type shift( value_type rem )
> { return rem << CHAR_BIT; }
>
> The problem is, if run time checking is active in VS2003 (I assume 2005 has
> the same issue), a pop-up warning is issued during every call to the function
> as data is lost. (that¹s the intent in fact). The fix is to mask (rem <<
> CHAR_BIT) & 0xffff (or whatever the appropriate mask value is for
> value_type). Is this a known issue? It¹s technically not a bug but could cause
> some annoyances for anybody using rtc. Should this be changed?

What's the point of the mask? The affected bits have already gone to
oblivion at that point. Maybe RTC has a bug?

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

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