10 ms·
Primeval C: two very early compilers
- limmeau 14y agoNo "entry" keyword. I looked.
- stormbrew 14y agoThe fact that early pointer notation was just suffix [] is interesting. If they'd stuck with that it would have avoided the a*b ambiguity.
- xymostech 14y agoAnd if they hadn't, people would be confused about whether something's supposed to be a pointer or an array. I think I like the current syntax much better.
- stormbrew 14y agoTrue. But it really could have been anything suffix, including probably *, and it would have still resolved that ambiguity.
- coldtea 14y ago>And if they hadn't, people would be confused about whether something's supposed to be a pointer or an array. Not that they aren' confused between pointers and arrays now.
- mortdeus 14y agoyeah, I found this last night and posted it on Reddit. Thanks for the cross post. I have a github repo open for it I if anybody wants to fork. I won't merge pull requests. github.com/mortdeus/legacy-cc
- asveikau 14y agoIs it me or is it weird to say "thanks for the cross-post" for something written by Dennis Ritchie?
- mortdeus 14y agoAs in thanks for linking it to hacker news, because I didnt after finding the article last night.
- asveikau 14y agoI read this article a few years ago, does that entitle me to recognition? Obviously not. It just struck me as taking credit for non-accomplishments.
- mortdeus 14y agoWhat are you even talking about? I was thanking the poster for doing something I didnt do myself. This is the x-post I was talking about. http://www.reddit.com/r/programming/comments/19gnki/legacycc_the_earliest_versions_of_the_very_first/ http://www.reddit.com/r/programming/comments/19gnki/legacycc... I am not seeking any sort of recognition for the post whatsoever.
- coldtea 14y agoYou are the second person bringing up DR in this post for reasons having nothing to do with DR himself. The "post" part is about who posted it to HN, not about who wrote the article.
- leothekim 14y agoI just glanced at this: http://cm.bell-labs.com/cm/cs/who/dmr/last1120c/c10.c http://cm.bell-labs.com/cm/cs/who/dmr/last1120c/c10.c What is/was the purpose of the ospace() and waste() functions?
- leothekim 14y agoOh never mind, RTFA
- jacquesm 14y agoNo css, no javascript, loads in a flash (pun intended), the way a web page should be. On top of that it contains mostly information rather than mark-up and eye candy.
- jrajav 14y agoUm, yes, and this kind of unstyled webpage is also the kind that makes me twitch straight to my "Make Readable" CSS-forcing bookmarklet so that I can read it in a legible size, line spacing, and line width, rather than having it trawl all the way across my widescreen monitor in 12pt serif. It can get exhausting keeping up with all of the silly CSS/JS web trends, I realize, but there is a good reason for a lot of it.
- zerohp 14y agoYour browser has awful defaults. There's no CSS, so your browser is responsible for presenting it in a readable form.
- nawitus 14y agoFirefox doesn't present it in a readable form (the page width is so large that reading the text is annoying). Which browsers handle this well?
- 1337p337 14y agoFirefox and Webkit both allow a user-specified stylesheet, although it is buried a bit in Firefox.
- jamesgeck0 14y agoThat's not by default. User-specified CSS is even less usable by most end users than a 3rd party "make readable" bookmarklet.
- 14y ago
- gwern 14y agoThese are very early compilers indeed, but it makes me wonder: a HN comment today reminded me of 'Proebsting's law' that compilers double program speed every 18 years. He got this by comparing a -O0 run with a -02 run and then dividing, but the obvious problem with this is that even if a modern compiler is run with -O0 it's probably going to be in effect optimizing a lot just by all the architectural choices and default code generation. It would be interesting to see if one could take a more recent C compiler, say late '70s and compare it to a heavily optimizing GCC run, and answer the question: how much have C compilers improved over the last 30-40 years?
- kragen 14y agoI am pleasantly surprised to see that current GCC seems to be able to generate code for a PDP-11 target. I think there may actually even be cycle-accurate PDP-11 simulators around, which would enable you to do the benchmarking. If you do get around to it, I'd love to hear your results!
- vanderZwan 14y agoAren't most optimisations hardware dependant, and if so: wouldn't it make sense that the work put into these optimisations depends largely on how much the hardware is used? Is the PDP-11 still a useful target in that sense? Wouldn't the original x86 instruction set be more useful for example?
- 1337p337 14y agoThe situation with x86 specifically is a little weirder than that: http://www.emulators.com/docs/nx06_rmw.htm http://www.emulators.com/docs/nx06_rmw.htm . It's a bit of a long read, but the summary is that on some x86s, single-instruction adds to memory are faster, and on others, load/increment/store in three instructions is faster. Compiler optimization be a harsh mistress.
- kragen 14y agoWell, if you want to compare a 1970s compiler to a modern compiler, the x86 instruction set will not be a useful target, since no 1970s compilers target it. These particular ancient compilers target the PDP-11. The larger question of whether optimizations are hardware-dependent is interesting. In some sense, sure. But there are a lot of optimizations in modern compilers that apply equally well to the PDP-11 and to the AMD64; they're just not that different. My homework assignment for you: write a C function of three or four lines which loops over an array of structs and does some computation for each one, including some conditional and a call to a one-line static function; compile it with -c -O0 -Wa,-adhlns=unoptimized.lst and with -c -O5 -fomit-frame-pointer -Wa,-adhlns=optimized.lst; list the optimizations you notice in the difference between unoptimized.lst, and hazard a guess at which of them are applicable on a PDP-11.