From: dmr@dutoit.UUCP Newsgroups: net.lang.c Subject: Where did ++ come from? Message-ID: <2140@dutoit.UUCP> Date: Sat, 21-Jun-86 04:22:22 EDT Article-I.D.: dutoit.2140 Posted: Sat Jun 21 04:22:22 1986 Lines: 36 Phaedrus@eneevax guessed that a lot of notation in C came from PDP-11 assembly language, and Chris Torek's reply did indeed drag me out of my torpor. Nothing in the C syntax came from the PDP-11, because all the relevant parts were imported from B, which was in use before the PDP-11 existed. In fact things are somewhat the other way around; the reason the Unix PDP-11 assembler resembles B (and C) more than does DEC's, is that I wrote the first Unix PDP-11 assembler, in B, before we had a DEC assembler. It was written from the machine description. It used * and $ rather than @ and # because the former were analogous respectively to the B notation and to other assembly languages I knew, and (equally) because @ and # were the kill and erase characters. As to ++ and --: these were Thompson inventions as far as I know, or at least the idea of using them in both prefix and postfix form. No doubt the autoincrement cells in the PDP-7 contributed to the idea, but there was a significant generalization, or rather isolation of the significant operations into ++ -- and *, as Chris pointed out. If you haven't heard of autoincrement cells, here is the idea: certain locations (010-017) in low memory in the PDP-7 (and also the -8, but just one cell, probably 010), acted like ordinary memory locations, unless indirection was applied through them. In that case, after the indirect reference, 1 was automatically added to them. It was useful for stepping through arrays, especially because these machines lacked index registers. * came from the version of BCPL we were using. (Pure BCPL used "rv" for "*" and "lv" for "&"). By the way, B had assignment versions of all the binary operators, including === and =!=. Since it didn't have &&, the question of =&& did not arise. The ones missing from C were dropped for lack of interest. Dennis Ritchie