Since this community has yet to have it’s first proper post, I thought this question would be a good one to start off with. Personally, I mainly use C. I find it’s simplicity and decades of usage provides itself as easy to use and very well documented. With that being said, memory management can become a bit tricky in C when you get into the realm of optimising and hacking things together. As such I have started to explore Rust and Zig as alternatives to try out.

Currently I am experimenting with a little Rust kernel. So far, it has a terrible VGA driver implementation and a lot of it needs refactoring before I can even think about getting a keyboard driver up and running to take input. The design, if any at all, is monolithic at the moment with everything running at ring 0 considering there are no rings at all. With that being said, Rust seems pretty robust so far, and the memory borrowing systems has allowed freed me up in the memory management department quite a bit. It’s a bit of a learning curve, but I am getting there!

As for Zig, I recently got the language installed on my Debian machine, but I am not sure what to write to try it out, feel free to leave suggestions for me :)

  • DigitalJacobin
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I started out using C, but recently i’ve started using Rust and i really like it so far

    I don’t really know enough about Rust yet to touch on specific upsides and downsides, but it’s just generally easier to work with i’ve found, especially for more functional programming.

    • Alex
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Rust has all the facilities of a high level language but also allowing you to get down to the low level (unsafe) implementation details. I think C still has the edge for very low level stuff but Rust does away with a lot of the foot guns of C.

      • comfisofaOPM
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 year ago

        Rust even supports doing inline assembly similar to C, I have yet to use it but I would assume this would be very helpful when writing really low level code to get a function as optimised for each architecture as possible.

    • comfisofaOPM
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Memory borrowing took me a second to warp my head around, but it is a very nice alternative to pointers. I’ve gotten lost in the rabbit holes of multiple pointers and dereferences to one variable in C before, and Rust helps you avoid a lot of those issues.

  • 257m
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    For me personally I could never leave C. C gives you everything you need and nothing more. Sometimes you have problems with it being it awkward with modern hardware that dosen’t resemble a PDP-11 as it kinds of assume PDP-11 style memory model with no vectorization but most hardware is built with C in mind anyways