B programming language

HomePage | Recent changes | View source | Discuss this page | Page history | Log in |

Printable version | Disclaimers | Privacy policy

Seen now as a transition phase between BCPL and C, B was mostly the work of Ken Thompson and first appeared in 1969 or thereabouts. It was essentially BCPL stripped of anything Thompson felt he could do without, in order to fit it on very small computers, and with some changes to suit Thomson's tastes, mostly along the lines of reducing the number of non-whitespace characters in a typical program.

Like BCPL and FORTH, B had only one datatype, the computer word. Most operators treated this as an integer (ie, +, -, *, /) but others treated it as a memory address to be dereferenced. In most other ways it looked a lot like an early version of C. A few library functions existed, including some that vaguely resemble functions from the standard IO library in C.

Early implementations were for the DEC PDP-7 and PDP-11 minicomputers running early Unix, and Honeywell 36 bit mainframes running GCOS. The earliest implementations compiled to threaded code. At some stage a native code compiler for the PDP-11 was produced, and at some stage Dennis Ritchie took over maintenance of the compiler.

The typeless nature of B made sense on the Honeywell, PDP-7 and many older computers, but was a problem on the PDP-11 because it was difficult to elegantly access the character data type that the PDP-11 and most modern computers fully support. Ritchie made changes to the language, most notably adding data typing for variables, and circa 1972 B evolved into "New B" and then C.

At that stage B should probably have died, but it continued to see use as late as the 1990s on Honeywell mainframes, and on certain embedded systems, mostly because these poor deprived (and depraved) systems didn't have anything better. The highly influential AberMUD was written in B.

/Talk