• refalo@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    Yea but all that function pointer indirection can actually hurt performance (especially caching), some things in C++ actually can be faster just because the compiler is better at optimizing for that.

    • jabjoe@feddit.uk
      link
      fedilink
      English
      arrow-up
      0
      ·
      9 months ago

      There is nothing you can do in C++ or C, that can’t be done in the other. It’s the kind of the point of those languages.

      • refalo@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        9 months ago

        Technically you’re right, but I don’t think that changes what I said about optimization. There are still cases where equivalent C++ code can be faster than the C version merely due to different optimizations used.