News for hackers. Stuff that matters.
Re:Beautiful Code: Is there a better way of writing v = (v =... by gte910h on Tuesday August 16, 2011 @12:26PM (#2891775)
If you insist on one line

    if (v>0) v=0; else v=1;
Otherwise

    if(v>0)
      v=0;
    else
      v=1;
Some of us prize readability over neat tricks. I think there are a 100 ways most of these answers could be misinterpreted by people. Code is read more than it is written, and programs rarely work better because you wrote it slightly more "impressively". Modern compilers do much of this sort of stuff that they are doing in this thread, but they do it in a repeatable manner which future programmers don't have to puzzle out.

There are no comments on this comment yet.