Why does Knuth use this clunky decrement? : <p>I'm looking at some of Prof. Don Knuth's code, written in CWEB that is converted to C. A specific example is dlx1.w, available from <a href="https://www-cs-faculty.stanford.edu/~knuth/programs.html" rel="noreferrer">Knuth's website</a></p>

<p>At one stage, the .len value of a struct nd[cc] is decremented, and it is done in a clunky way:</p>

<pre><code>  o,t=nd[cc].len-1;
  o,nd[cc].len=t;
</code></pre>

<p>(This is a Knuth-specific question, so maybe you already know that "o," is a preprocessor macro for incrementing "mems", which is a running total of effort expended, as measured by accesses to 64-bit words.)  The value remaining in "t" is definitely not used for anything else.  (The example here is on line 665 of dlx1.w, or line 193 of dlx1.c after ctangle.)</p>

<p>My question is: why does Knuth write it this way, rather than</p>

<pre><code>nd[cc].len--;
</code></pre>

<p>which he does actually use elsewhere (line 551 of dlx1.w):</p>

<pre><code>oo,nd[k].len--,nd[k].aux=i-1;
</code></pre>

<p>(And "oo" is a similar macro for incrementing "mems" twice -- but there is some subtlety here, because .len and .aux are stored in the same 64-bit word.  To assign values to S.len and S.aux, only one increment to mems would normally be counted.)</p>

<p>My only theory is that a decrement consists of two memory accesses: first to look up, then to assign.  (Is that correct?)  And this way of writing it is a reminder of the two steps.  This would be unusually verbose of Knuth, but maybe it is an instinctive aide-memoire rather than didacticism.</p>

<p>For what it's worth, I've searched in <a href="http://www.literateprogramming.com/cweb.pdf" rel="noreferrer">CWEB documentation</a> without finding an answer.  My question probably relates more to Knuth's standard practices, which I am picking up bit by bit.  I'd be interested in any resources where these practices are laid out (and maybe critiqued) as a block -- but for now, let's focus on why Knuth writes it this way.</p>
