News for hackers. Stuff that matters.
Re:Implemented proposals for Swift 3 by stormbrew on Saturday May 07, 2016 @02:19PM (#11650688)

    int arr[5];
    int i = 0;
    while (shouldIKeepGoing() && i < 5) arr[i++] = getAThing();
If you use ++i there you'll skip 0 and overflow the array. This is what the postfix form is for, if you value terseness.

Edit: To clarify, I'm not necessarily saying you don't know that's what it's for, but this is a pattern I see pretty frequently in the wild so I'm just throwing it out there with an explanation of why people find value in it.

There are no comments on this comment yet.