It’s actually really easy when you get to make everything up as you go along.
Comment on Bell Labs 'Unix' Tape from 1974 Successfully Dumped to a Tarball
truthfultemporarily@feddit.org 3 weeks ago
They wrote this without googling anything.
bigfondue@lemmy.world 3 weeks ago
WhiskyTangoFoxtrot@lemmy.world 3 weeks ago
The modern world was born in NJ
* looks at modern world *
Yeah, that tracks.
bigfondue@lemmy.world 3 weeks ago
Yea I thought about having ‘for better for worse’ but I lived in NJ so I’ll let them have a little glory for once
xthexder@l.sw0.com 3 weeks ago
Hello World in 1974: echo.c
main(argc, argv) int argc; char *argv[]; { int i; argc--; for(i=1; i<=argc; i++) printf("%s%c", argv[i], i==argc? '\n': ' '); }
ZoteTheMighty@lemmy.zip 3 weeks ago
Bloat, they wasted an extra integer operation with
argc–.xthexder@l.sw0.com 3 weeks ago
I think it’s actually quite elegant. No matter what it has to skip over argument 0 which will be the executable name
echo.
If the subtraction was removed and the loop changed to<, it would then need to do an addition or subtraction inside the loop to check if it’s the last argument.palordrolap@fedia.io 3 weeks ago
The real question might be whether the compiler was smart enough to change
var++andvar--into++varand--varwhen the initial values aren't needed.As compiler optimisations go, it's a fairly obvious one, but it was 1974 and putting checks like that in the compiler would increase its size and slow it down when both space and time were at a premium.
surewhynotlem@lemmy.world 3 weeks ago
Or they just drop the =
bigfondue@lemmy.world 3 weeks ago
If you had a question about C, you would just consult K&R, but not the book
ylph@lemmy.world 2 weeks ago
[deleted]bigfondue@lemmy.world 2 weeks ago
Have you read the Unix: A History and a Memoir? I only started it, but the first chapter or two is just Kernighan talking about Bell Labs.
BreadstickNinja@lemmy.world 2 weeks ago
They were chatting with ELIZA and vibe coded the whole thing
mech@feddit.org 3 weeks ago
They wrote this without autocompletion or syntax highlighting.
Nanook@lemmy.zip 3 weeks ago
They had PAPER NOTEBOOKS cheats
bstix@feddit.dk 3 weeks ago
They also used the classic they knew what they were doing shortcut.