Re: Strange Operator
From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 03/31/04
- Next message: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Previous message: Simon Lewis: "Re: Strange Operator"
- In reply to: Simon Lewis: "Strange Operator"
- Next in thread: Simon Lewis: "Re: Strange Operator"
- Reply: Simon Lewis: "Re: Strange Operator"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Mar 2004 22:32:34 +1000
"Simon Lewis" <sheepboy69uk@NOSPAMyahoo.com> wrote in message
news:c4eans$8q1$1@wotsit.aston.ac.uk...
| Dear All,
|
| I have been stepping though some code, and came across the following
| operator:
|
| value >>= 1;
|
| (value is an int)
|
| It seems to be assigning 1 to value, could anyone shed some light on its
| meaning?
It is a 'bitwise - right-shift' operator.
It's affect is to shift all bit's to the right, by the
nominated value. For example:
int value = 10;
value >>= 1;
...would look like this:
// 00001010
// 00000101 == 5
Btw, when combined with the assignment operator '=', it
is known as an compound operator, which performs the shift
and assignment within the same expression.
Cheers.
Chris Val
- Next message: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Previous message: Simon Lewis: "Re: Strange Operator"
- In reply to: Simon Lewis: "Strange Operator"
- Next in thread: Simon Lewis: "Re: Strange Operator"
- Reply: Simon Lewis: "Re: Strange Operator"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|