On Saturday, July 19, 2003, at 07:32 PM, Tim Hunter wrote:

> [snip]

> As for the pre-increment and both flavors of decrement, forget it. The
> pre- and post-increment/decrement operators are only there because the
> machines on which C originally ran had INC and DEC machine instructions
> and it was easy to get the compiler to generate them. They're a 
> remnant of
> the old days.

As it happens, I was just reading Dennis Ritchie's history of C, at

http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

and he says the following about the reasons for the increment/decrement 
operators:

"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."

Regards,

Mark