On Tue, 5 Jan 2010, Andrew Makhorin wrote:
Run-Time Check Failure #1 - A cast to a 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);
What this does is implementation dependent.
char c = (char)i;
char c = (char)(i & 0xFF);
char c = (char)(i & CHAR_MAX);
char c = (char)(i & UCHAR_MAX);
char c = (char)(unsigned char)i;
would all be better, but all still implementation dependent.
None should give you a warning.
They might give you five different results.
If chars are unsigned,
all except possibly the second will do what you probably want.
Life is more interesting if chars are signed.
C defines conversions from unsigned to
signed types only in their common range.
The others are implemenation defined.
This advice is helpful for quiche eaters only :)
Because MSVS 2008 would issue warning for such a conversion, the bigmul
is modified as
union {
unsigned int uint;
struct { unsigned short ush1, ush2 ;} ush;
} tuiush;
[...]
x[i+j] = (unsigned short)tuiush.ush.ush1;
If preceded by an assignment to tuish.uint, it would be undefined behaviour.
--
Michael [email protected]
"Pessimist: The glass is half empty.
Optimist: The glass is half full.
Engineer: The glass is twice as big as it needs to be."
_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk