General > General Technical Chat
C language 50th anniversary
bsfeechannel:
--- Quote from: niconiconi on July 22, 2022, 10:19:20 am ---To be more historically accurate.
--- Code: (c) ---main()
{
printf("Happy 50th anniversary C!!!");
}
--- End code ---
In pre-ANSI C (K&R C, as found in the 1st ed. K&R), all functions without a specified return type are implied to be int, the main() function without a return type is implied to be 0 in practice, and printf's definition was provided by the compiler by default.
Here's a PDP-11 simulation run on the original UNIX v6 system.
PDP-11 simulator V3.11-0
Disabling XQ
Listening on port 1106 (socket 7)
SR:
@unix
login: root
#
# ls
bin
core
dev
etc
lib
mnt
rkunix
tmp
unix
usr
# ed
a
main()
{
printf("Happy 50th anniversary C!\n");
}
w 50th.c
51
q
# cc 50th.c
# ./a.out
Happy 50th anniversary C!
Not to say it's a good style in 2022. By modern standard it's sloppy - but it was what the original C was - a quick-and-dirty experimental design to test ideas, just like UNIX was also a quick-and-dirty experimental operating system for the same purpose. Both are probably the most productive experiment in computing history.
--- End quote ---
I tried to replicate that in Linux, but the ed version I have demands the insertion of a single period (".") on a line to terminate the input mode. Did the ed of old dispense with the period?
PaulAm:
No, ed always used a single period to terminate input mode (how else are you going to tell the program to start taking commands again?). The poster missed it.
niconiconi:
--- Quote from: PaulAm on July 22, 2022, 06:13:17 pm ---No, ed always used a single period to terminate input mode (how else are you going to tell the program to start taking commands again?). The poster missed it.
--- End quote ---
I actually used an EOF (Control-D) to terminate the input, which unfortunately is invisible and didn't appear in the text log. It was a real simulation run.
Marco:
--- Quote from: bsfeechannel on July 22, 2022, 05:17:17 pm ---Bashing C is like bashing the soldering iron just because today we have pick-and-place machines.
--- End quote ---
IT is like a world persistently manufacturing electronics by soldering irons when there's pick and place machines and reflow.
coppice:
--- Quote from: Picuino on July 22, 2022, 07:22:48 am ---The first version of the C language (the C compiler and some utilities made with it) appeared in 1972. I have not been able to find out in which month exactly. In any case I am very happy for the 50th anniversary.
At the time it took me a little bit of a big effort to learn C. In those years the fashionable language was Pascal and its implementation by Borland, TurboPascal. TurboPascal had many libraries and was much more productive than C in the MS-DOS based PC environment.
--- End quote ---
Your timing is a bit off. Pascal was loved by academics in the early 70s, but had little presence elsewhere until the 1980s and TurboPascal. Several C compilers, notably Lattice C, appeared about the same time as TurboPascal, but were more expensive. TurboPascal's low price gained it a strong following. Cheap C compilers were a bit late.
I've been writing C for 45 years.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version