Announcement

Collapse
No announcement yet.

Indian Developers Redesigning Linux Kernel With OOP, C++ Support

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

  • #41
    They should have gone with JavaScript.

    Comment


    • #42
      let them try!

      Speaking as someone who is working C++, with linux drivers...

      First, Linus is right.
      See: Why should I have written ZeroMQ in C, not C++ (part I)
      Second: let them try! Maybe some good will come of it

      Comment


      • #43
        Originally posted by d4ddi0 View Post
        Speaking as someone who is working C++, with linux drivers...

        First, Linus is right.
        See: Why should I have written ZeroMQ in C, not C++ (part I)
        Second: let them try! Maybe some good will come of it
        That ZeroMQ post is just silly. C++ is a (loose) superset of C. If some of the additional abstractions offered by the language don't do the job for you, don't use them.

        Comment


        • #44
          Originally posted by log0 View Post
          That ZeroMQ post is just silly. C++ is a (loose) superset of C. If some of the additional abstractions offered by the language don't do the job for you, don't use them.
          If you're advocating building C with a C++ compiler, it comes only with downsides: larger binaries, slower operation, and slower compilation.

          Comment


          • #45
            Originally posted by DataPath View Post
            C doesn't have vtables. vtables are the implementation permitting virtual method resolution on classes that inherit from others (or are inherited from).
            Of course C has virtual tables. How do you think drivers are currently implemented everywhere in the kernel? The problem with C vtables is just they have to do them by hand, which leads to tons of pointless boilerplate code, and it is actually slower than compiler optimized vtables, where the compiler can know when to call something directly which is much harder for the compiler to do with C-style function pointer structs.

            A C-driver is a number of structs containing function pointers, and pointers to inherited parent structs of function pointers.

            struct my_driver_class {
            struct parent_driver_class* parent;
            void (*my_first_virtual_method)(int, int);
            void (*my_second_virtual_method)(int, int);
            }

            ugly ugly shit that would be cleaner, faster and safer with C++.

            Comment


            • #46
              Originally posted by mendieta View Post
              Ha, they got all of the overhead, and none of the benefits! But this is early code.
              in c vs c++, zero benefit means zero overhead.

              Comment


              • #47
                Originally posted by curaga View Post
                If you're advocating building C with a C++ compiler, it comes only with downsides: larger binaries, slower operation, and slower compilation.
                maybe slower compilation, but slower operation is bullshit.

                Comment


                • #48
                  Originally posted by d4ddi0 View Post
                  Speaking as someone who is working C++, with linux drivers...

                  First, Linus is right.
                  See: Why should I have written ZeroMQ in C, not C++ (part I)
                  Second: let them try! Maybe some good will come of it
                  I stopped reading after he explained how exceptions are unfit for when you can handle the error in place. Well of course :/ exceptions are there specifically when you cannot handle the error in the local scope.

                  Comment


                  • #49
                    Originally posted by erendorn View Post
                    maybe slower compilation, but slower operation is bullshit.
                    Thanks, for GCC it seems it was only 0.1% slower then.

                    Comment


                    • #50
                      Originally posted by DataPath View Post
                      C doesn't have vtables. vtables are the implementation permitting virtual method resolution on classes that inherit from others (or are inherited from).
                      Call them whatever you like. vtables, function pointers... whatever, they're all the same. See post #45 for more info.

                      Originally posted by DataPath View Post
                      Speak for yourself. My phone runs mostly native code (Android's ART), which, on the benchmarks I've seen, is between 25% and 400% faster than Dalvik and probably about 40% faster on average.
                      Yeah, I run mine with ART too. However that's nothing more than a workaround/optimization. You still end up having a garbage collector, no manual control over memory allocation and so on. Anyway, that's kind of off topic...

                      Comment

                      Working...
                      X