It has an interesting code style, the comments go _after_ the function definition but before the opening bracket.
It looks weird, but it actually makes sense! The flow is more natural - first the function definition, and then the explanation of what it does. It also avoids repeating the function name.
Code from that era predates the web, and a lot of open source style guides, and even most open source code itself.
So it came up in an era where folks were inventing their own style and the huge homogenizing influence of the gnu standards (and other open source projects) hadn't taken hold.
I like it. It feels like another language, and has its advantages. I really like to know of alternate ways of doing things, even if I don't adopt them myself.
You got me thinking about C/C++ style guides of my youth...
I think Indian Hill (C, not C++) was the first one I ever read: <a href="https://www2.cs.arizona.edu/~mccann/cstyle.html" rel="nofollow">https://www2.cs.arizona.edu/~mccann/cstyle.html
Looks like there is an updated version (1997) here: <a href="https://www.cs.cornell.edu/people/egs/comp303/tutorials/cstyle.pdf" rel="nofollow">https://www.cs.cornell.edu/people/egs/comp303/tutorials/csty...
Paul Haeberli's "The SGI C Source Compliance Requirements" is hard to forget:
<a href="https://www.graficaobscura.com/ccode/index.html" rel="nofollow">https://www.graficaobscura.com/ccode/index.html
I wonder whether there is a centralised historical archive of C/C++ style guides?
cyberax · · focus · HN ↗
It looks weird, but it actually makes sense! The flow is more natural - first the function definition, and then the explanation of what it does. It also avoids repeating the function name.
compiler-guy · · focus · HN ↗
So it came up in an era where folks were inventing their own style and the huge homogenizing influence of the gnu standards (and other open source projects) hadn't taken hold.
I like it. It feels like another language, and has its advantages. I really like to know of alternate ways of doing things, even if I don't adopt them myself.
RossBencina · · focus · HN ↗
I think Indian Hill (C, not C++) was the first one I ever read: <a href="https://www2.cs.arizona.edu/~mccann/cstyle.html" rel="nofollow">https://www2.cs.arizona.edu/~mccann/cstyle.html
Looks like there is an updated version (1997) here: <a href="https://www.cs.cornell.edu/people/egs/comp303/tutorials/cstyle.pdf" rel="nofollow">https://www.cs.cornell.edu/people/egs/comp303/tutorials/csty...
Paul Haeberli's "The SGI C Source Compliance Requirements" is hard to forget: <a href="https://www.graficaobscura.com/ccode/index.html" rel="nofollow">https://www.graficaobscura.com/ccode/index.html
I wonder whether there is a centralised historical archive of C/C++ style guides?
The modern staples are covered here, I guess:
<a href="https://github.com/kciter/awesome-style-guide#cpp" rel="nofollow">https://github.com/kciter/awesome-style-guide#cpp