title: C/C++ Post-increment by more than one
body: <p>I'm reading bytes from a buffer. But sometimes what I'm reading is a word or longer. </p>
  
  <pre><code>// assume buffer is of type unsigned char *
  read_ptr(buffer+(position++))
  </code></pre>
  
  <p>That's fine but how can I post-increment position by 2 or 4? There's no way I can get the <code>+=</code> operator to post-increment, is there? </p>
  
  <p>Reason is, I have this big awful expression which I want to evaluate, while at the same time incrementing the position variable. </p>
  
  <p>I think I came up with my own solution. I'm pretty sure it works. Everyone's gonna hate it though, since this isn't very readable code.  </p>
  
  <pre><code>read_ptr(buffer+(position+=4)-4)
  </code></pre>
  
  <p>I will then make this into a macro after testing it a bit to make sure it's doing the right thing.</p>
  
  <p><strong>IN CONCLUSION:</strong></p>
  
  <p>Don't do this. It's just a bad idea because this is the sort of thing that generates unmaintainable code. But... it does turn out to be quite easy to convert any pre-incrementing operator into a post-incrementing one. </p>