• arendjr@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      8 days ago

      I would argue that because C is so hard to program in, even the claim to machine efficiency is arguable. Yes, if you have infinite time for implementation, then C is among the most efficient, but then the same applies to C++, Rust and Zig too, because with infinite time any artificial hurdle can be cleared by the programmer.

      In practice however, programmers have limited time. That means they need to use the tools of the language to save themselves time. Languages with higher levels of abstraction make it easier, not harder, to reach high performance, assuming the abstractions don’t provide too much overhead. C++, Rust and Zig all apply in this domain.

      An example is the situation where you need a hash map or B-Tree map to implement efficient lookups. The languages with higher abstraction give you reusable, high performance options. The C programmer will need to either roll his own, which may not be an option if time Is limited, or choose a lower-performance alternative.

        • witx@lemmy.sdf.org
          link
          fedilink
          arrow-up
          1
          ·
          6 days ago

          And how testable is that solution? Sure macros are helpful but testing and debugging them is a mess

          • RheumatoidArthritis@mander.xyz
            link
            fedilink
            arrow-up
            1
            ·
            5 days ago

            You mean whether the library itself is testable? I have no idea, I didn’t write it, it’s stable and out there for years.

            Whether the program is testable? Why wouldn’t it be. I could debug it just fine. Of course it’s not as easy as Go or Python but let’s not pretend it’s some arcane dark art

        • arendjr@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          8 days ago

          Well, let’s be real: many C programs don’t want to rely on Glib, and licensing (as the other reply mentioned) is only one reason. Glib is not exactly known for high performance, and is significantly slower than the alternatives supported by the other languages I mentioned.

            • arendjr@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              8 days ago

              Which one should I pick then, that is both as fast as the std solutions in the other languages and as reusable for arbitrary use cases?

              Because it sounds like your initial pick made you loose the machine efficiency argument and you can’t have it both ways.