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

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

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

    Either as an elaborate April Fool's Day prank or the start of something more, longtime kernel developer David Howells of Red Hat has posted 45 patches that begin the work on porting the Linux kernel to build under a C++ compiler rather than C...

    http://www.phoronix.com/scan.php?pag...el-CXX-Patches

  • #2
    Maybe a very carefully chosen also very precise subset of C++ standard. Certainly not something like STL

    Comment


    • #3
      Originally posted by onicsis View Post
      Maybe a very carefully chosen also very precise subset of C++ standard. Certainly not something like STL
      Really. If this is for real, it's because Howells (and others) have very specific features of C++ they wish to use. An appropriate Coding Standard would not be inappropriate.

      Comment


      • #4
        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.

        Comment


        • #5
          I agree with Linus, the kernel should be written in C. Basically my opinion boils down to less high level stuff available to mess things up in subtle ways.

          Comment


          • #6
            Originally posted by Djhg2000 View Post
            I agree with Linus, the kernel should be written in C. Basically my opinion boils down to less high level stuff available to mess things up in subtle ways.
            Why not go further and use assembler instead of C?

            Comment


            • #7
              Linus is not amused.

              And STL is not the essence of the problem, it is all the boilerplate generated for high level code by the compiler, which varies between implementations. It is basically a black box you have no control over. Not a critical issue for application development, and its benefits greatly outweigh the obscurity problem, but that stuff doesn't belong in the kernel, contrary to simple logic it will make it much harder to maintain, and will open a can of worms that will take a long time to work around, and it will probably take an efficiency hit.

              It is kinda ironic, because the downsides of using C++ in the kernel are almost exactly the same as the downsides of using C in application code.

              Modern C++ is a huge language, very complex in its entirety, and relies increasingly on more and more code generation, and at the same time, it is still very limited. I had a problem recently, that would have been solved most efficiently by putting user data in the class vtable, alas, no can do in C++, but perfectly doable in C, since you implement vtables manually.

              I also think C++ is horrible, in fact it has gotten close to atrocious. The language gets increasingly more complex to use, the standards and syntax grow devoid of any consistence and often logic or common sense, and the increase of complexity outweighs the increase of functionality. To the point people have to invest so much into mastering the language itself that it happens at the expense of their creativity. The standard committee is basically turning it more and more into a language for well paid worker drones.

              In this aspect, it gets even further from being suitable for kernel development. It wasn't invented for that purpose to begin with. Of course, it is not uncommon to see programming languages shoehorned places they don't belong. which is how JavaScript gets to be the N1 application programming language LOL...
              Last edited by ddriver; 04-01-2018, 08:37 PM.

              Comment


              • #8
                Originally posted by gigaplex View Post
                Why not go further and use assembler instead of C?
                Because Assembly language is the least portable programming language. Whereas C is the most portable. There is probably a lot of code in the kernel that is actually written in assembly, but it only worth the effort in the most performance critical sections.

                Comment


                • #9
                  That trollish smile on Linus' face.... priceless, loving the guy.

                  Comment


                  • #10
                    Originally posted by ddriver View Post

                    Because Assembly language is the least portable programming language. Whereas C is the most portable. There is probably a lot of code in the kernel that is actually written in assembly, but it only worth the effort in the most performance critical sections.
                    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.

                    Comment

                    Working...
                    X