News for hackers. Stuff that matters.
Re:What is the name of this operator: “--”? by The_Egg_Man on Monday October 22, 2012 @10:34PM (#4686477)
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-...

Re:What is the name of this operator: “--”? by stephen_g on Monday October 22, 2012 @11:04PM (#4686537)
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.

Re:What is the name of this operator: “--”? by ctdonath on Monday October 22, 2012 @10:41PM (#4686487)

  #define as ;while
  ...
  do printf("n is %d\n", n) as ( n --> 0);
Parses to (white space adjusted for clarity):

  do printf("n is %d\n", n);
  while ( n-- > 0);
Re:What is the name of this operator: “--”? by dmbass on Monday October 22, 2012 @10:45PM (#4686497)
The preprocessor replaces the macro "as" with ";while" creating a do-while loop.

  do {
   printf("%d",x);
  } while (x-- > 0);