Announcement

Collapse
No announcement yet.

Red Hat Developer Posts Patches As A Baby Step To Converting Linux Kernel To C++

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

  • #11
    Originally posted by stalkerg View Post
    I think very long time about C+ language, it's should be C but with syntax sugar and some features like:
    namespaces
    function overloading
    templates (templates much better than macros)

    and all this can work without classes.
    Function overloading would heavy complicate ABI, one thing a lot of people don't like about C++. I don't think that should be part of C.
    Templates are fine but still wouldn't be part of the kernel as it adds a type of abstraction that's looked down upon in really-low-level programming.

    Comment


    • #12
      That said, it *is* April Fool's day.

      Comment


      • #13
        C++? I think our beloved Linux kernel should be converted to Basic.
        J/K (if it wasn't obvious)

        Comment


        • #14
          I guess I'm the only one that thinks the Linux Kernel should be ported to Python.

          Comment


          • #15
            Originally posted by computerquip View Post
            That said, it *is* April Fool's day.
            Frankly I can't imagine this being anything other than an April's fool joke. Linus has stated many tImes that he won't accept any C++ in the kernel so if this was for real, it wouldn't survive the first post on LKML. Unless RedHat wants to actually fork the kernel and maintain its own OS written in C++, originally based on Linux, which is if course permitted and possible.

            Comment


            • #16
              Originally posted by Spooktra View Post
              I guess I'm the only one that thinks the Linux Kernel should be ported to Python.
              Yes you must be the only one, even if Linux was ported to Python, which would be pretty dumb, you would still need to embed Python runtime engine into the kernel binary which itself is written in C. Having ability to script existing kernel is not that dumb, it is very useful, NetBSD kernel can be scripted with Lua.

              Comment


              • #17
                Torvalds is also very very proficient in C. This makes his job easier since he has to review a large number of patches.

                Comment


                • #18
                  Originally posted by hax0r View Post

                  Yes you must be the only one, even if Linux was ported to Python, which would be pretty dumb, you would still need to embed Python runtime engine into the kernel binary which itself is written in C. Having ability to script existing kernel is not that dumb, it is very useful, NetBSD kernel can be scripted with Lua.
                  Admittedly I'm not really that familiar with NetBSD but do they actually do something really interesting with Lua in the kernel? Scripting the kernel is not dumb per se, but integrating something that relies on a garbage collector, dynamic dispatch and dynamic typing certainly sounds like a gigantic stability and security liability. I suspect (but correct me if I'm wrong) that NetBSD's Lua experiment has to do with the fact that NetBSD wants to gain more exposure by positioning itself as an OS hacker's platform, as opposed to Linux which rules production applications or OpenBSD which has an unchallenged niche as an OS for network devices. Kernel Lua might be intended as an easy and user-friendly way to try stuff, prototype drivers etc., not something that could or should be deployed and relied upon in prod.

                  Comment


                  • #19
                    Originally posted by onicsis View Post
                    Maybe a very carefully chosen also very precise subset of C++ standard. Certainly not something like STL
                    I agree.

                    Back in the days I converted a piece of horrible C code with double pointer stuff and all kind of fixes to C++.
                    It went from 90k very unreadable code to 15k very clean and readable code.
                    Back then C++ wasn't much more than C + classes (C++98 ?)

                    Client didn't want it, as C++ was quite new, and it was "not portable".

                    For my own projects, I still do it this way.
                    The advantage of basic C++, and you're still writing C.

                    I wouldn't mind seeing the kernel converted to this, as it has worked quite well for me.

                    Not sure what the disadvantage of the generated code from a modern C++ compiler would be, though.

                    Comment


                    • #20
                      Originally posted by sandy8925 View Post

                      Didn't they remove most of that code recently? I read about it on Phoronix, they removed some x86 initialization code written in assembly, and replaced it with C. Apparently, the kernel booted faster after replacing it.
                      C tends to be easier to maintain and compilers can generally generate better assembly than hand writing it.

                      Comment

                      Working...
                      X