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

  • #51
    Originally posted by OneTimeShot View Post

    There do not exist two programmers who can agree on a subset of C++. All C++ "experts" have their own favourite pet features.
    I guess you have never heard of the C++ Core Guidelines? There are even checkers for clang and MS Visual Studio.

    Comment


    • #52
      Originally posted by carewolf View Post

      All major projects use the same subset. The only weird ones are Boost and STL because it is written by programming wankers who like features that are banned everywhere else.
      I'm not sure where you got that idea, but I can assure you it isn't true.

      There is no mutually agreed on subset of C++.

      Comment


      • #53
        Originally posted by slacka View Post

        I guess you have never heard of the C++ Core Guidelines? There are even checkers for clang and MS Visual Studio.

        LOL. No: I'm dumb. I've coded in C++ for 15 years. Every C++ programmer I have ever met has automatically assumed that they are better than me and that what they do is "the real C++". Spoiler: what they actually did mostly contradicted each other.

        At least Java programmers have the good grace to say: "yeah - it's a dumb, slow, easy-to-learn language. It gets the job done, though."

        Comment


        • #54
          Originally posted by pal666 View Post
          we are talking about kernel and kernel does not provide any kind of stable c function abi
          i guess they are looked down mostly by people who don't understand what are they talking about. btw, tell us how macros add a type of abstraction that's looked down upon by kernel devs
          Sure, because even in kernel code, such as in Haiku, you still don't see templates. I guess no one knows what they're talking about.

          Macros generate code to avoid duplication, i.e. it places a blob of code where you place a macro in order to avoid having to put that same thing everywhere. Complicated macros that do things like type manipulation or structure generation is generally looked down upon in the kernel because it's not immediately clear what those things are doing. It's easy to introduce bugs or use it in a way that causes an issue that is actually hard to find.

          There are exceptions, one of those being container_of which confuses a lot of developers (despite being useful especially outside of the kernel). You can consider things like the list_for_each macro but ultimately, that just avoids code duplication still while making it easier for the developer to use the linked list.

          The fact that you equate macros to templates is kinda ridiculous by the way. They aren't the same thing and they aren't used the same way.

          Comment


          • #55
            Originally posted by computerquip View Post
            C tends to be easier to maintain and compilers can generally generate better assembly than hand writing it.
            Compilers can't usually beat hand-optimized assembly (as seen in media decoding libraries for example).

            The point is that the skills required to make decent hand-optimized assembly and also the time required are plain off the charts.

            Comment


            • #56
              Originally posted by OneTimeShot View Post

              Yay - a C++ programmer. And you're disagreeing and arguing with other C++ programmers about technical decisions... Thanks for proving my point
              Bitching on forums does not make someone a programmer (this is valid for pal666 and also for people he is shouting at), there is so much posturing on Teh Internetz.

              I agree on your main point though.

              Comment


              • #57
                Originally posted by computerquip View Post

                Sure, because even in kernel code, such as in Haiku, you still don't see templates. I guess no one knows what they're talking about.
                I had to check on that because I was confused. And of course I was right. :-)

                There are templates in Haiku. Go clone github.com:haiku/haiku.git and see:
                • kernel/TeamThreadTables.h
                • kernel/arch/arm/arch_debug.cpp
                • kernel/arch/m68k/arch_int.cpp
                • kernel/arch/ppc/arch_int.cpp
                • kernel/arch/x86/64/descriptors.cpp
                • kernel/arch/x86/arch_debug.cpp
                • kernel/debug/core_dump.cpp
                • kernel/debug/tracing.cpp
                • kernel/device_manager/FileDevice.cpp
                • kernel/disk_device_manager/ddm_userland_interface.cpp
                • kernel/elf.cpp
                • kernel/scheduler/RunQueue.h
                • kernel/scheduler/scheduler_profiler.cpp
                • kernel/scheduler/scheduler_profiler.h
                • kernel/slab/slab_private.h
                • kernel/team.cpp
                • kernel/vm/vm.cpp

                Comment


                • #58
                  Originally posted by gigaplex View Post
                  Why not go further and use assembler instead of C?
                  Portability?

                  Comment


                  • #59
                    Originally posted by Zan Lynx View Post

                    I had to check on that because I was confused. And of course I was right. :-)

                    There are templates in Haiku. Go clone github.com:haiku/haiku.git and see:
                    • kernel/TeamThreadTables.h
                    • kernel/arch/arm/arch_debug.cpp
                    • kernel/arch/m68k/arch_int.cpp
                    • kernel/arch/ppc/arch_int.cpp
                    • kernel/arch/x86/64/descriptors.cpp
                    • kernel/arch/x86/arch_debug.cpp
                    • kernel/debug/core_dump.cpp
                    • kernel/debug/tracing.cpp
                    • kernel/device_manager/FileDevice.cpp
                    • kernel/disk_device_manager/ddm_userland_interface.cpp
                    • kernel/elf.cpp
                    • kernel/scheduler/RunQueue.h
                    • kernel/scheduler/scheduler_profiler.cpp
                    • kernel/scheduler/scheduler_profiler.h
                    • kernel/slab/slab_private.h
                    • kernel/team.cpp
                    • kernel/vm/vm.cpp
                    That's interesting. I'll take a look at those. I would assume most of them were in userspace but seems some are not and they've been there awhile.

                    Comment


                    • #60
                      Originally posted by Zan Lynx View Post

                      I'm not sure where you got that idea, but I can assure you it isn't true.

                      There is no mutually agreed on subset of C++.
                      Google, Apple, Microsoft and Qt and anyone using their C++ toolkits uses almost identical subsets of C++. Only Boost is weird by allowing exceptions

                      Comment

                      Working...
                      X