[Zlib-devel] zlib: Run-Time Check Failure #1 - A cast to smaller data type
Mark Adler
madler at alumni.caltech.edu
Mon Aug 27 11:11:03 EDT 2007
On Aug 27, 2007, at 5:09 AM, Glenn Randers-Pehrson wrote:
> Visual Studio say: Run-Time Check Failure #1 - A cast to smaller
> data type
> has caused a loss of data. If this was intentional, you should mask
> the
> source of the cast with the appropriate bitmask. For example: char
> c = (i &
> 0xFF); Changing the code in this way will not affect the quality of
> the
> resulting optimized code.
Glenn,
Thank you for the report.
Does Visual Studio have to be asked to produce this "check failure"?
I'm wondering if this should be fixed, since it's not obvious that
all compilers will optimize out the & 0xff. I believe that there are
many other places in zlib where the & 0xff is implicit in the
assignment to a char.
Mark
More information about the Zlib-devel
mailing list