[Format] boost 1.48.0, vs2010 runtime check triggered by cast to smaller type in feed_args.hpp

running the code below triggers a runtime crash due to casting to a smaller type in feed_args.hpp if -RTCc is given. we turn on this runtime check for debug builds as shown in the sample code. so far the only remedy I've found is to turn off runtime checks for the entire module, not a nice solution. microsoft's suggestion, to use a pragma to turn off the check, doesn't work (not your problem I know).
the same issue exists in boost 1.47.0.
thx
dxc
// ----- cut ----
// boost 1.48.0
// visual studio 10.0, service pack 1, windows 7/64
// using this pragma, per microsoft, does not solve the problem
// #pragma runtime_checks( "", off )
#include <string>
#include

On 2011-11-23 16:47, david x callaway wrote:
running the code below triggers a runtime crash due to casting to a smaller type in feed_args.hpp if -RTCc is given. we turn on this runtime check for debug builds as shown in the sample code. so far the only remedy I've found is to turn off runtime checks for the entire module, not a nice solution. microsoft's suggestion, to use a pragma to turn off the check, doesn't work (not your problem I know).
the same issue exists in boost 1.47.0.
I had the same with 1.38, and as solution I changed this line
(feed_args.hpp):
static_cast

I had the same with 1.38, and as solution I changed this line (feed_args.hpp): static_cast
(specs.truncate_ - !!prefix_space), into static_cast ( ( specs.truncate_ - !!prefix_space) & size_type( ~0 ) ),
similar thing for crc.hpp: - { return x ^ rem; } + { return ( ( x ^ rem ) & unsigned char( ~0 ) ); } Regards, Bogdan
participants (2)
-
Bogdan Slusarczyk
-
david x callaway