[Python-Dev] [Python-checkins] cpython: Avoid useless "++" at the end of functions

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu May 26 20:14:42 CEST 2011

On Thu, May 26, 2011 at 11:26 AM, Eric Smith <eric at trueblade.com> wrote:
>> Have to looked at the patch? The patch and resulting code look sane to me, and
>> if anything at most of the updated segments look cleaner after the patch.
> I have looked at it. I think the code was better before the patch. If I
> were looking at this, I'd have to wonder why the pointer was incremented
> everywhere else, but not here. This is especially true when the changed
> code isn't particularly near the end of the function.


To me, *p++ = c is an idiomatic way to fill the buffer.  I prefer to
think of p as the state of the stream for which adding a character is
impossible without advancing the state.  Seeing *p = c will definitely
make me pause and think whether or not it is a bug.

More information about the Python-Dev mailing list