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

      Look at the kernel code. It’s full of OOP C. There absolutely are objects in the kernel.

      • refalo@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        6 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
          ·
          6 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
            ·
            6 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.