
What is the name of this operator: “--”? - QuarkSpark
http://stackoverflow.com/questions/1642028/what-is-the-name-of-this-operator
======
rwolf
The title is missing a >. Should be "-->"

~~~
QuarkSpark
For some reason it changes the "-->" back to "--" I tried many times/ways to
include the entire operator before giving up & just posting it..

~~~
sukuriant
What about &gt; ?

------
The_Egg_Man
Could someone break this down and explain it to me? [1] It looks hilariously
atrocious yet interesting at the same time.

[1]: [http://stackoverflow.com/questions/1642028/what-is-the-
name-...](http://stackoverflow.com/questions/1642028/what-is-the-name-of-this-
operator/2860927#2860927)

~~~
stephen_g
Basically, somebody sees some code with two operators (decrement and less
than) with no whitespace between them and thinks it's a single operator.

The answer that shows it with the brackets is probably the clearest:

    
    
        while ((x--) > 0)
        { ... }
    

The compiler sees that as the same as (x--> 0)

So it checks if x is more than zero and then decrements it each loop
iteration.

------
antihero
From the thread:

    
    
      while (x --\
                  \
                   \
                    \
                     > 0) 
           printf("%d ", x);
    

That's fantastic!

------
sukuriant
This looks mostly like a function that sacrificed readability for brevity, to
the detriment of at least one reader.

------
halis
Decrement x = x -1

