I was looking at some code today on SGI super computer, and wanted to make sure that there are no 32-64 bit problems in the code since SGI was super computer. I found the following thing to be interesting
<---------------------->
((unsigned long)a_ptr+(unsigned long)b_int)!=
(a_ptr+(unsigned long)b_int)
<---------------------->
That is if I cast both the operands of binary + to (unsigned long)
the value I get from that addition is different from if I cast
just one operand of binary + to (unsigned long), whats the compiler
doing here? since if both the operands to binary + are unsigned long
and the value(no.of bits) could be larger than sizeof(unsigned long)
is it the reason why I get different values here?, I couldn't find
this in FAQ.
No comments:
Post a Comment