47 points · by susam · 5y ago · 26 comments
Basically B was based on BCPL, a really early systems language. Then B was rewritten as C. The next iteration of C was called C++ as a joke because it's C plus 1. Though there has since been another language created as an evolution of C called D
From what I gather, B never really got much use outside of Bell Labs. But I might have missed some reports on other people using it.
Wiktionary tells me it stands for "sorry, could not resist".
putchar("New line: *n")
putchar("Escaped double quotes: *"")In B everything was an integer, and there was no separate pointer type. It had only pointer operators that could be applied to any integer.
I think you're right that B is related to this, the reason the brackets were on the right of the name is because no type was mentioned in B (as there was only one type). If types had been named in declarations they probably would have preferred to do what Java does, i.e. `Type[] name`.
The other more archaic reason the brackets are on the right is because in the oldest B compilers the brackets were not there at all, instead when declaring 'local' (auto) vectors you just write the length of the vector after its name, like `auto name 8;` would declare a vector length 8 called 'name'. Once again this syntax makes sense without the type.
In B, declarators had not really matured yet, in some situations you could declare a vector with brackets similar to C arrays, but only of one dimension (which I think is why they were called vectors and not arrays).
begin
integer x[1:42];
...
end> All arithmetic in B is integer, unless special functions are written. There is no equivalent of the Fortran IJKLMN convention, no floating point, no data types, no type conversions, and no type checking. Users of double-precision complex will have to fend for themselves. (But see ->32 for how to call Fortran subroutines.)
I wonder if it would have been beneficial to continue with this separation. Fortran and C started trying to do everything and they failed. Fortran was never a contender for C for systems programming, and C has not moved in the right direction to be better than Fortran for numerical computing.
You have an interesting definition of failure.
And C got the floating point operations B did not have, and was actually used for lots of numerical work for a while (and it still is, up to some point), but nobody was totally happy with it so we got C++, new Fortran versions, Python, now Julia... Although it always is an option due to the availability and quality of C compilers, I would not say that C succeeded in becoming the language of choice for scientific computing.
Of course, this does not mean that C or Fortran are failures.