Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As for the reason why, here is what K&amp;R had to say on the subject:</p> <h2>Brian Kernighan</h2> <blockquote> <p>you'll have to ask dennis (and it might be in the <a href="http://cm.bell-labs.co/who/dmr/chist.pdf" rel="nofollow noreferrer">HOPL paper</a>). i have a dim memory that it was related to the post-increment operation in the pdp-11, though beyond that i don't know, so don't quote me.</p> <p>in c++ the preferred style for iterators is actually ++i for some subtle implementation reason.</p> </blockquote> <h2>Dennis Ritchie</h2> <blockquote> <p>No particular reason, it just became fashionable. The code produced is identical on the PDP-11, just an inc instruction, no autoincrement.</p> </blockquote> <h2>HOPL Paper</h2> <blockquote> <p>Thompson went a step further by inventing the ++ and -- operators, which increment or decrement; their prefix or postfix position determines whether the alteration occurs before or after noting the value of the operand. They were not in the earliest versions of B, but appeared along the way. People often guess that they were created to use the auto-increment and auto-decrement address modes provided by the DEC PDP-11 on which C and Unix first became popular. This is historically impossible, since there was no PDP-11 when B was developed. The PDP-7, however, did have a few ‘auto-increment’ memory cells, with the property that an indirect memory reference through them incremented the cell. This feature probably suggested such operators to Thompson; the generalization to make them both prefix and postfix was his own. Indeed, the auto-increment cells were not used directly in implementation of the operators, and a stronger motivation for the innovation was probably his observation that the translation of ++x was smaller than that of x=x+1.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload