Quote:
Originally Posted by Jake M
You know, I don't quite see why you converted everything to long. The two types are essentially the exact same: both are unsigned, 4 byte numerical variables. It is strange that you would have this problem by switching this yes, but I don't see why you would think it would change anything. In my experiences, I've never seen any difference at all between the two, except for the name. (I may be missing something, but if I am, then I'll learn something here too) If you were trying to make the variable larger, to prevent overflow, the only way you can go bigger is to use a long long or long long int.
Also, could you provide some sample values that those variables might have. If it is indeed a casting problem, and I have an idea of what those values should be, I can run some test code and probably figure it out.
|
they're not both 4 bytes. For some reason, an int is two bytes here. I found this out by printing a variable(int type) that was being incremented. When it was incremented pasted 32,xxx it overflowed and went back to -32,xxx. A long is bigger than an int. it wouldn't make much sense if it was the same size.
EDIT: Also, neither are unsigned, I have no idea where you got this from.