|
Boost Users : |
From: Norbert Unterberg (nunterberg_at_[hidden])
Date: 2007-04-22 04:41:39
Ovanes Markarian schrieb:
> Using numeric_cast I face a warning in MSVC 8.0 Express Edition
>
> e:\libraries\boost\include\boost-1_35\boost\numeric\conversion\cast.hpp(41) : warning C4267:
> 'return' : conversion from 'size_t' to 'Uint32', possible loss of data
[...]
> Trying to compile without warnings I am wondering about this warning, since I use the cast to
> raise an exception at runtime if data are lost. Is it logical?
You should show your code lines that generate this warning.
In Visual Studio 2005, when creating a project, the compiler enables the "64 bit
compatibility warnings" switch. And on the 64 bit compiler, size_t has 63 bits,
an Uint32 still has 32 bits. That is why the compiler warns about a possible
data loss.
Are you converting from size_t (or any of the container::size_types) to Uint32?
Norbert
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