On the one side I really like c and c++ because they’re fun and have great performance; they don’t feel like your fighting the language and let me feel sort of creative in the way I do things(compared with something like Rust or Swift).

On the other hand, when weighing one’s feelings against the common good, I guess it’s not really a contest. Plus I suspect a lot of my annoyance with languages like rust stems from not being as familiar with the paradigm. What do you all think?

  • mipadaitu@lemmy.world
    link
    fedilink
    English
    arrow-up
    67
    arrow-down
    3
    ·
    7 months ago

    Depends on if you’re coding for critical infrastructure (i.e. - electrical grid), or writing a high performance video game that can run on older hardware.

    We should absolutely have specific licenses like Civil Engineers do for computer infrastructure that is required for any software written for specific purposes. It would be a nightmare to implement, but at some point, it’s going to be needed.

    • SorteKanin@feddit.dk
      link
      fedilink
      arrow-up
      33
      arrow-down
      11
      ·
      7 months ago

      writing a high performance video game that can run on older hardware

      Unless it’s some really exotic platform, I’d honestly still say no. Rust has shown that memory safety and performance doesn’t have to be a tradeoff. You can have both.

      But sure, if whatever you’re targeting doesn’t have a Rust compiler, then of course you have no choice. But those are extremely rare cases these days I’d say.

      • themusicman@lemmy.world
        link
        fedilink
        arrow-up
        24
        arrow-down
        6
        ·
        7 months ago

        There’s always a trade-off. In rust’s case, it’s slow compile times and comparatively slower prototyping. I still make games in rust, but pretending there’s no trade-off involved is wishful thinking

        • Lmaydev@programming.dev
          link
          fedilink
          arrow-up
          29
          arrow-down
          1
          ·
          7 months ago

          They mean a trade off in the resulting application. Compile times mean nothing to the end user.

          • Dave.@aussie.zone
            link
            fedilink
            arrow-up
            14
            arrow-down
            3
            ·
            7 months ago

            That may be true but if the language is tough to develop with, then those users won’t get a product made with that language, they’ll get a product made with whatever language is easier / more expedient for the developer. Developer time is money, after all.

            • Lmaydev@programming.dev
              link
              fedilink
              arrow-up
              3
              ·
              edit-2
              7 months ago

              You’d be better just using a managed languages in many cases.

              With tiered jit and careful use of garbage allocations they can actually be the same or faster.

      • MareOfNights@discuss.tchncs.de
        link
        fedilink
        arrow-up
        6
        arrow-down
        5
        ·
        7 months ago

        Can we stop pretending Rust doesn’t take performance trade-offs? Of course if you compare it one to one its roughly the same, since it’s compiled. But Optimizing memory for cache hits becomes a lot more difficult in Rust, to the point where you have to use unsafe. And unsafe Rust has more undefined behavior than C. In my opinion C is more safe than unsafe Rust.

        If you want normal performance its a good Language, but once you need to Optimize memory, which is usually the bottleneck, You are out of luck.

      • cm0002@lemmy.world
        link
        fedilink
        arrow-up
        8
        arrow-down
        21
        ·
        edit-2
        7 months ago

        I don’t even think we really need to eek out every MHz or clock cycle of performance these days unless your shipping code for a space vehicle or something (But that’s an entirely different beast)

        We’ve got embedded devices shipping with 1GHz+ processors now

        It’s just time to move on from C/C++, but some people just can’t seem to let go.

        • Cirk2@programming.dev
          link
          fedilink
          arrow-up
          20
          ·
          7 months ago

          That is the mindset that gives us text editors using 100% cpu to blink a cursor because their css triggers a bug in the web browser they ship to render the text editor.

          You can be memory save without shipping a whole browser, but disregarding power and memory efficiency will just make performance gained by hardware evaporate in overhead.

        • pycorax@lemmy.world
          link
          fedilink
          arrow-up
          12
          ·
          7 months ago

          Battery life is a reason. I’ve had clients come to me complaining their solution from another vendor didn’t last very long. Turns out it was running Java on an embedded device.

          • Akisamb@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            7 months ago

            Why would java have an impact on battery performance ? Pretty much all credit cards run java for their encryption algorithms, and they need pretty much no power to run.

            • pycorax@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              7 months ago

              The JVM isn’t free. It was a simple data collection device that interfaces with a sensor which ideally doesn’t need maintenance as long as possible. Something light written in C is more than enough.

        • suy@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          7 months ago

          It’s just time to move on from C/C++, but some people just can’t seem to let go.

          The Rust community has 2 websites that I keep periodically checking: Are we game yet? and Are we GUI yet?. The answers on those sites are respectively (as of February 2024, when this comment is written) “Almost. We have the blocks, bring your own glue” and “The roots aren’t deep but the seeds are planted”. I’ve seen the progress in Bevy and Slint, but it’s still the same, those websites don’t change, and my situation WRT to making a Rust project for fun or work it’s the same.

          I’ll be happy to start doing Rust projects whenever I get the chance (which will be when it’s a sufficient tool for my use cases). But I’m tired of smoke sellers.

          • calcopiritus@lemmy.world
            link
            fedilink
            arrow-up
            2
            arrow-down
            4
            ·
            7 months ago

            Have you actually tried making a GUI or a game? I don’t think you can summarize the state of the whole ecosystem in a sentence that doesn’t change in years. I’ve made perfectly functional GUIs with iced, and imgui. Haven’t tried slint yet.

            Godot is a very popular game engine and it’s written in rust, so you probably can use it in rust.

            • suy@programming.dev
              link
              fedilink
              arrow-up
              2
              ·
              7 months ago

              I’ve wanted to start a project in Rust, but for the ideas that I have (and the time that I have for a hobby project, as for work it’s rarely starting a new one, but continuing and existing one), Rust seemed a viable, but not ideal alternative to just doing it all in C++, for which I already have enough knowledge and very well proven libraries. I will look again soon, and I will keep looking because eventually something will surely click, it’s just that so far, the time has not been right.

              Note that my point is not that it’s unusable for everyone. Just that it’s false that “some people just can’t seem to let [C or C++] go”, as the previous comment said. I can’t let go something that works well for something that doesn’t, given the projects that I have to work on.