Opened 12 years ago
Closed 12 years ago
#4208 closed Bugs (wontfix)
Boost::crc fails if Visual C++'s "/RTCc Convert to smaller type checks" is enabled
| Reported by: | anonymous | Owned by: | Daryle Walker |
|---|---|---|---|
| Milestone: | Boost 1.43.0 | Component: | crc |
| Version: | Boost 1.44.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
Boost::crc fails if Visual C++'s "/RTCc Convert to smaller type checks" is enabled
I would suggest to change crc_helper::index() from
static unsigned char index( value_type rem, unsigned char x )
{ return x ^ rem; }
to
static unsigned char index( value_type rem, unsigned char x )
{ return x ^ (rem & 0xFF); }
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
/RTCc yields non-conformant behavior. The behavior of the following program is well-defined (technically implementation defined since sizeof(short) is implementation defined) according to the C++ standard. In most implementations it will print 1.
#include <iostream>
int main() {
unsigned int i = 65537;
unsigned short s = static_cast<unsigned short>(i);
std::cout << s << std::endl;
}
Note:
See TracTickets
for help on using tickets.

would be slightly better.