compl operator

   
compl operator Bitwise complement operator

  unary-expr  := ~  cast-expr  compl  cast-expr  

The bitwise complement operator requires an integer or enumeration operand. It performs the usual arithmetic promotion and toggles each bit of its operand, resulting in an integer.

The compl keyword is interchangeable with the ~ token.

Example

 unsigned bitmask; bitmask = ~0xF107; // bitmask becomes 0xFFFF0EF8 (32 bits). 

See Also

bitand , bitor , expression , not , xor , Chapter 3, <ciso646>

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net