D
Davis King
I just discovered that sometimes on some compilers it is true that
(variable >> 32) == variable where variable is an unsigned long and on
these platforms an unsigned long is 32 bits. Is bit shifting a
variable in the manner undefined by the standard or is this just a bug
in the compiler?
examples:
in borland 5.5.1 the following code prints 1, I would expect it to be 0
unsigned long low = 1;
low >>= 32;
cout << low;
I also found a similar problem in visual studio but weather or not
(low>>32) == low or 0 is apparently dependent upon what (seeming
independent) statements precede the shift.
(variable >> 32) == variable where variable is an unsigned long and on
these platforms an unsigned long is 32 bits. Is bit shifting a
variable in the manner undefined by the standard or is this just a bug
in the compiler?
examples:
in borland 5.5.1 the following code prints 1, I would expect it to be 0
unsigned long low = 1;
low >>= 32;
cout << low;
I also found a similar problem in visual studio but weather or not
(low>>32) == low or 0 is apparently dependent upon what (seeming
independent) statements precede the shift.