Finally I have a valid reason to learn about memory management. It was also hella weird when encountering it.

  • 6nk06@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    arrow-down
    11
    ·
    3 days ago

    I’ve used C++20 on embedded devices and the generated code was simpler than the C version. Why do you still use C?

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        2 days ago

        That’s a nice recommendation.

        For a beginner without experience in using libraries, the additional requirements in Rust would feel unnecessary and frustrating.
        If you take up Rust after learning programming using C (which won’t require all that extra stuff and let you learn the basics easily), that would make it easier for you to appreciate the results of the extra work it makes you do.

      • N.E.P.T.R@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        4
        ·
        2 days ago

        Probably a good idea. I decided to learn Rust after using Python for a couple years. I took a semester of C++ but barely remember anything. Maybe I should write a project in C and rewrite later in Rust. I personally only learn when I get inspiration to make a program, which means I learn on the spot. I don’t think it is the best way to do things (if I knew the language better I may make better decisions), but it is the only way I can motivate myself to learn.

      • 6nk06@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        arrow-down
        31
        ·
        edit-2
        3 days ago

        C is useless nowadays (and has been for at least 20 years). Either learn Rust or C++.

        • vala@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          12
          ·
          2 days ago

          This is such an incorrect take for real. C is far from useless and still used all over the place in all kinda of professional projects. And I’m talking new projects started this year, not just legacy maintenance.

        • da_cow (she/her)@feddit.orgOP
          link
          fedilink
          arrow-up
          12
          ·
          3 days ago

          The reason I got recommended to learn C first is so that you are getting used to handling memory by yourself. Then you switch to rust and since you are used to handling memory your rust code is usually better quality.

          Another reason I want to learn C is because I regularly have to work with Arduinos.

          • anton@lemmy.blahaj.zone
            link
            fedilink
            arrow-up
            3
            ·
            2 days ago

            I can’t comment whether learning C first improves your rust, but it certainly makes you appreciate what the rust compiler does.
            Also learning rust improved my C.

            • Decq@lemmy.world
              link
              fedilink
              arrow-up
              6
              ·
              2 days ago

              I think it’s a fair strategy. If they know what happens if you do it wrong people suddenly complain less about rust’s borrow checker. Whereas people who are only used to garbage collected language don’t usually have the slightest clue why it works the way it does.

              • henfredemars@infosec.pub
                link
                fedilink
                English
                arrow-up
                1
                ·
                2 days ago

                I don’t blame you. I have to use a professionally sometimes and I am not a fan. It’s an absolute behemoth of the language filled with warts and cruft.

                Sometimes it is the best choice for a project, but I prefer languages with simple, orthogonal concepts.

        • FiskFisk33@startrek.website
          link
          fedilink
          arrow-up
          7
          ·
          edit-2
          3 days ago

          it is good to learn C, even if you’re never gonna touch it again. It teaches you what other languages abstract away.

        • henfredemars@infosec.pub
          link
          fedilink
          English
          arrow-up
          5
          ·
          2 days ago

          I’m the tech lead on a three-year-old project that’s entirely in C. It is my full time job to write C89.