News for hackers. Stuff that matters.
Re:A glimpse of undefined behavior in C by bookface on Saturday November 30, 2013 @07:07PM (#6825342)
I like using it when I'm filling an array with an indeterminate number of elements. I've used this pattern a few times:

    foo foos[255];
    int ct = 0;

    if (<condition for adding first element>)
        foos[ct++] = foo1;

    if (<condition for adding second element>)
        foos[ct++] = foo2;

    ...

    for (int i = 0; i < ct; i++) {
        /* do something with foos[i] */
    }
IMHO, this is more concise and readable than separating the increment and assignment into two lines.

There are no comments on this comment yet.