‹ BackHN Continuity

Thread

Writing Efficient C++ Code (2013)

176 points · 161 comments · ibobev

  1. 112233 · · focus · HN ↗
    "This article was originally published in Polish in issue 4/2013" — a lot of excellent advice. Sad to see C++ have moved in last decade in a direction that makes writing efficient, simple low level code harder and harder :(
    1. fooblaster · · focus · HN ↗
      How? you can write exactly the same low level code today.
      1. AlotOfReading · · focus · HN ↗
        Shot in the dark, but maybe the OP is referring to the fact that these code conventions are explicitly discouraged by the C++ core guidelines. The SoA example falls afoul of the rule requiring T* to be used only for singular object pointers, for example.
        1. someonebaggy · · focus · HN ↗
          Core guidelines, and any other pattern document, should be downstream of working code, not upstream.
          1. AlotOfReading · · focus · HN ↗
            Okay? The point of the guidelines is to document principles the committee's thinks "good" C++ should follow, within the much larger universe of possible C++ code.
            1. someonebaggy · · focus · HN ↗
              So if you find good code that works a different way, do you update your beliefs on what good code is, or on whether that code is good?
              1. AlotOfReading · · focus · HN ↗
                To summarize, the grandparent comment lamented how it's sad that the modern language has diverged from the code in the article. Someone else pointed out that the code still works. I suggested that the complaint remains valid in spite of that because the language committee's core guidelines prohibit it. Notice I haven't mentioned my opinion at all.

                You've responded to that suggestion with seemingly irrelevant comments. Do you see why I'm confused?

                For what it's worth, my actual opinion is that the committee is usually wrong/misguided.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.