Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 28
    Wikipedia says: "A (false) folk myth is that the instruction set architecture of the PDP-11 influenced the idiomatic use of the C programming language. The PDP-11's increment and decrement addressing modes correspond to the −−i and i++ constructs in C. If i and j were both register variables, an expression such as *(−−i) = *(j++) could be compiled to a single machine instruction. [...] Dennis Ritchie unambiguously contradicts this folk myth. [The Development of the C Language]" Commented Feb 1, 2011 at 0:20
  • 3
    Huh (From the link provided in FredOverflow's comment): "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." Commented Feb 1, 2011 at 0:28
  • 3
    DMR only said that the PDP-11 was not the reason it was added to C. I said that too. What I said was that it was used to advantage on the PDP-11 and became a popular design pattern for that exact reason. If Wikipedia contradicts that then they are simply wrong, but I don't read it that way. It is phrased poorly on that W page. Commented Feb 1, 2011 at 0:30
  • 3
    @FredOverflow. I think you misunderstood exactly what the "folk myth" is. The myth is that C was designed to exploit those 11 ops, not that they don't exist and not that the code pattern didn't become popular because everyone knew they mapped to the 11 well. In case it isn't clear: the PDP-11 really really does implement those two modes in hardware for almost every instruction as an addressing mode, and it really was the first important machine C ran on. Commented Feb 1, 2011 at 0:32
  • 2
    "it must have mattered a lot on those 0.001GHz machines". Um, I hate to say it because it dates me, but I had Motorola and Intel manuals for my CPUs to look up the size of the instructions and how many cycles they took. Finding the smallest codes added up to being able to add one more feature to a print spooler and saving a couple cycles meant a serial port could keep up with some protocol like that newly invented MIDI. C relieved some of the nit-picking, especially as the compilers improved, but still it was important knowing what was the most efficient way to write code. Commented Feb 1, 2011 at 6:57