Re: Strange Operator

From: Rob Audenaerde (qro_at_oce.nl)
Date: 04/01/04


Date: Thu, 01 Apr 2004 10:11:11 +0200

On Wed, 31 Mar 2004 12:40:39 +0100, Simon Lewis
<sheepboy69uk@NOSPAMyahoo.com> wrote:

> 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 syntactically the same as:

value +=1;

which is short for something like:

value = value + 1;

so in

value >>=1;
value = value >> 1;

where >> is the right shift operator



Relevant Pages

  • Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
    ... Anyway when stepping through the MFC code it throws an ... if, hInst)) ... After stepping through it I realize that the Dlg.DoModal ... CDRVCEDLGS_API int WINAPI CdrvLInitDialog( ...
    (microsoft.public.vc.mfc)
  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... memory with a single handle on it, ... to contiguous blocks of memory which are guaranteed to be ... short int a; ... I suspect that ISO hasn't defined the meaning of "region" any more ...
    (comp.lang.c)
  • Re: Question about void pointers
    ... That is undefined behavior by reason of trying to print an pointer ... unsigned int on many systems. ... Yes, but that difference has no portable meaning, and the ...
    (comp.lang.c)
  • Re: Term for a set with no limit points?
    ... that to give one of its most-used terms a double meaning like this ... the characteristic property of zero sets of analytic functions ... A is nowhere dense when int cl A = nulset. ...
    (sci.math)
  • Re: Justification for "->"?
    ... in standard C 'ptr = some_value;' is a constraint ... so it doesn't have an unambiguous meaning. ... Assigning an int to a pointer does not have a meaning; ...
    (comp.lang.c)