Announcement

Collapse
No announcement yet.

A 2024 Discussion Whether To Convert The Linux Kernel From C To Modern C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by mmstick View Post

    Your comment gave me a good laugh. Not only is Go not a suitable replacement for C, it makes many of the same mistakes, and adds some new ones.

    My honeymoon with the Go language is extremely over. This article is going to have a different tone from what I've been posting the past year - it's a proper rant. And I alw...


    Go is not even in the same class as C, C++, or Rust for the mere fact that it automatically spawns a multi-threaded async runtime with a runtime garbage collector, and spawns multiple threads before the main function. Compare to Rust, where automatic garbage collection with a runtime is neither necessary nor sufficient. It has an expansive open source ecosystem where you can choose to opt into any allocator or async runtime of your choice.
    man, are you able to read or what?
    did you miss that i clearly stated "not saying that Go would suite the development of a kernel, I'm just answering your specific question"

    Comment


    • #22
      Originally posted by ayumu View Post
      Allowing Rust was a mistake.


      Now, Linux is left wide open to this sort of proposal.
      As if "this sort of proposal" was a bad thing. A mixture of C++ and Rust works very well for a kernel, as evidenced by a certain other kernel running on hundreds of millions of devices.

      Comment


      • #23
        This would allow the mainline kernel to make use of inline template functions, inline overloaded functions ...
        Really? How is overloading useful for Kernel stuff? You always want to explicitly see what kind of data you handle an be aware of it, not obfuscate it. Is there even ever the need for a function to take different data types? Most of the times (handling buffers, copying memory, etc) you only care about bytes anyway and don't really do anything with the data.

        I want bash as a new kernel language!

        Comment


        • #24
          I'm not familiar with all the improvements of c++ in version 20. But error handling nightmare was one main reason for why it most certainly did not fit into kernel/low level library code previously. IIRC the author of zeromq came to regret writing it in c++ and abandoned the project to rewrite it in c.

          Maybe it finally is fixed and a kernel c++ subset could make some sense.

          Comment


          • #25
            Originally posted by archkde View Post

            As if "this sort of proposal" was a bad thing. A mixture of C++ and Rust works very well for a kernel, as evidenced by a certain other kernel running on hundreds of millions of devices.
            I assume you mean Windows NT? I heard it started using some Rust lately, but isn't it mostly C, just like Linux?

            Comment


            • #26
              Oh. shit.

              Comment


              • #27
                Originally posted by ayumu View Post
                Allowing Rust was a mistake.


                Now, Linux is left wide open to this sort of proposal.
                That proposal is older than Rust itself. Torvalds rejected that idea in 2007 and earlier he admitted that they tried C++ in 1992.

                Comment


                • #28
                  I feel like Zig would be a true replacement for C IMO.

                  Comment


                  • #29
                    i get the point of going from C to Rust it really makes perfect sense then kernel hackers need to learn 2 languages.

                    going from C+Rusr to C+Rust+C++ would give the kernel hackers the pain to force them to now learn 3 languages.

                    not a good idea. they just dream about keeping the C code and compile it as C++ but i think it is better to just replace it all with Rust code.
                    Phantom circuit Sequence Reducer Dyslexia

                    Comment


                    • #30
                      As a C programmer that the past two years has had to learn a lot of Rust and C++ on a deeper level, while both are pretty clean when you start learning it, both become much more complicated than C when looking at real world use of it. Rust is more complicated than C, but C++ is on a whole other level due to it having an insane amount of ways to do the same thing. We have now ended up writing most of our code in either C or Rust, with bindings between them where necessary.

                      Comment

                      Working...
                      X