‹ BackHN Continuity

Thread

EDG C++ front-end goes public

249 points · 129 comments · iandinwoodie

  1. cyberax · · focus · HN ↗
    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.

    1. mhh__ · · focus · HN ↗
      This is also where conditions go in languages with contracts, I like it
    2. zerr · · focus · HN ↗
      This is common in Lisps.
    3. bobmarleybiceps · · focus · HN ↗
      never occurred to me to write a comment there, but it actually looks kind of clean imho. Really old C code looked like

      void func(var1, var2) int var1, char* var2. { ... }

      perhaps some legacy from that? Probably not, but just first thing that popped into my head since it feels similar :shrug:

    4. 1718627440 · · focus · HN ↗
      I write comments about what a function does and it's interface before, but comments about the implementation after. Also my pre- and post-conditions go there of course. (I'm mostly writing in C.)
    5. spatulon · · focus · HN ↗
      One of the more unusual aspects is the naming convention for types. Most type names use the a_ prefix (e.g. a_statement_ptr), but names beginning with a vowel start with an_ instead (e.g. an_object_lifetime_ptr).
    6. compiler-guy · · focus · HN ↗
      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.

      1. RossBencina · · focus · HN ↗
        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:&#x2F;&#x2F;www2.cs.arizona.edu&#x2F;~mccann&#x2F;cstyle.html" rel="nofollow">https:&#x2F;&#x2F;www2.cs.arizona.edu&#x2F;~mccann&#x2F;cstyle.html

        Looks like there is an updated version (1997) here: <a href="https:&#x2F;&#x2F;www.cs.cornell.edu&#x2F;people&#x2F;egs&#x2F;comp303&#x2F;tutorials&#x2F;cstyle.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.cornell.edu&#x2F;people&#x2F;egs&#x2F;comp303&#x2F;tutorials&#x2F;csty...

        Paul Haeberli&#x27;s &quot;The SGI C Source Compliance Requirements&quot; is hard to forget: <a href="https:&#x2F;&#x2F;www.graficaobscura.com&#x2F;ccode&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;www.graficaobscura.com&#x2F;ccode&#x2F;index.html

        I wonder whether there is a centralised historical archive of C&#x2F;C++ style guides?

        The modern staples are covered here, I guess:

        <a href="https:&#x2F;&#x2F;github.com&#x2F;kciter&#x2F;awesome-style-guide#cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kciter&#x2F;awesome-style-guide#cpp

    7. asveikau · · focus · HN ↗
      I&#x27;ve seen that in other code bases. Can&#x27;t think of them offhand right now.
    8. RossBencina · · focus · HN ↗
      Numerical Recipes in C does that.
      1. jabl · · focus · HN ↗
        Numerical Recipes in C is an existence proof of the adage that the determined FORTRAN programmer can write FORTRAN in any language.

        (Using FORTRAN here rather than the more correct Fortran to denote the traditional pre-modern (Fortran 90+) programming style.)

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.