‹ 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. jll29 · · focus · HN ↗
      I think it has become EASIER: for instance, since C++23 Rust-like move semantics can be used, which provides the compiler with extra information that can be leveraged for the generation of better code.

      Or take constexpr - it permits to move computations to compile time that are complex and in older versions either had to be done at runtime, or an ugly workaround had to be used (e.g. assigning a mysterious literal pre-computed in another run or by hand).

      1. creata · · focus · HN ↗
        > C++23 Rust-like move semantics can be used

        What C++23 feature allows that?

        1. cherryteastain · · focus · HN ↗
          Maybe this one?

          <a href="https:&#x2F;&#x2F;www.open-std.org&#x2F;jtc1&#x2F;sc22&#x2F;wg21&#x2F;docs&#x2F;papers&#x2F;2022&#x2F;p2266r3.html" rel="nofollow">https:&#x2F;&#x2F;www.open-std.org&#x2F;jtc1&#x2F;sc22&#x2F;wg21&#x2F;docs&#x2F;papers&#x2F;2022&#x2F;p22...

          1. aw1621107 · · focus · HN ↗
            I think that&#x27;s basically clarifying the conditions under which C++11-style moves can be performed.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.