G
Glen Able
Just to get my head straight on this...
Firstly, am I right in thinking that right-shifting a signed integer has an
undefined result (i.e. could be implemented as a logical or arithmetic
shift)?
If so, am I also right in assuming that if I right-shift a signed integer by
an unsigned integer, the signed value will be promoted to unsigned and the
shift will be performed as a logical right shift?
Finally, if I specify an int literal, am I right in thinking that it's
treated the same way as any other signed integer, and will be promoted to
unsigned in the same way?
thanks in advance,
glen.
Firstly, am I right in thinking that right-shifting a signed integer has an
undefined result (i.e. could be implemented as a logical or arithmetic
shift)?
If so, am I also right in assuming that if I right-shift a signed integer by
an unsigned integer, the signed value will be promoted to unsigned and the
shift will be performed as a logical right shift?
Finally, if I specify an int literal, am I right in thinking that it's
treated the same way as any other signed integer, and will be promoted to
unsigned in the same way?
thanks in advance,
glen.