For background, the question is to prepare some training material, which should also should explain a bit why the things are the way they are.
I tried to get some idea of how C began based on this tutorial.
However, this does not give the answer and already has more in the language than I expected.
I learned at university that the first C implementations only had int
, so there was no need to give a data type and that this is the reason why leaving it out still leads to an integer.
Interestingly there it is explained that int
can be e.g. 16, 32 or 36 bits, depending on the machine.
First, can one confirm that there was really only int at the beginning and no float/double (I would not be surprised because it was written to have a compiler for UNIX to my understanding).
Second, can one give me a reference how and when it came to be 32 bits for int
?
int
" - are you possibly talking about the default type of function arguments, together with the fact that int-returning functions didn't need a forward declaration? Perhaps interacting with the separate fact that some rudimentary hardware only had theword
type natively in their instruction sets?float
anddouble
. You may be thinking of the predecessor language B.char
to typeless B was only called 'new B', and the first language called C addedstruct
and explicit pointer types; while it was already known additional types were needed for FP, since on PDP-11 they weren't (always) the same size, he doesn't say if those types were implemented yet. The bwk link shows they were implemented by 1974.