Thread: unsigned right shift operator

  1. #1
    Registered User
    Join Date
    Dec 2008

    unsigned right shift operator

    Apparently, when I use the unsigned right shift operator (>>>), I receive an error during compilation.

    I am using MinGW.

    Is this operator not available in C? If so, what would be the equivalent to this?

    Thank you,

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    There is no >>> in C. If your variable is unsigned, it should happen automatically with >>.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    There is unfortunately no >>> operator in C or C++ (though there is in other languages like Java).

    The >> operator does what you are expecting. On signed integers, the >> may do sign-extension or it may do an unsigned shift, depending on the implementation. For signed integers, if you need one particular behaviour, you can emulate it yourself with other bitwise operators.

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Replies: 12
    Last Post: 08-11-2008, 11:02 PM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM
  5. ANY BODY WILLING TO HELP ME WITH Microsoft Visual C++
    By BiG pImPiN fOoL in forum C++ Programming
    Replies: 12
    Last Post: 11-04-2001, 06:03 PM