Announcement

Collapse
No announcement yet.

C++20 Draft Approved As Major Update To C++ Programming Language

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

  • #61
    Originally posted by carewolf View Post

    It was before he even understood the language, and made under the assumption the kernel had to use ALL C++ features. A common noob mistake.
    I mean, C++98 has no lambdas, meh algorithms, no std::array, no constexpr, and overall lacks so much stuff.

    Writing C++98 is horrible.

    Comment


    • #62
      Originally posted by Mangix View Post

      I mean, C++98 has no lambdas, meh algorithms, no std::array, no constexpr, and overall lacks so much stuff.

      Writing C++98 is horrible.
      You should have seen pre-C++98 C++.. It wasn't even standardized, and you couldn't even rely on namespaces or consistently functioning templates.

      Comment


      • #63
        Originally posted by carewolf View Post

        It was before he even understood the language, and made under the assumption the kernel had to use ALL C++ features. A common noob mistake.
        Good point. He had whole friggin kernel functioning for quite some time, before he managed to get through learning curve. He was noob for what, first 15 years or so ?
        What's the point ?

        Personally, I'm struggling with Rust, these daxys, but compared to C++, this is like reading traffic signs.
        With C++, often I wasn't sure if I'm holding the book upside down.
        I've read it few time, tried few demos, but was always on the verge of vomiting.
        It takes for granted certain mental perspective and abstractions, which should be understood and used by everyone.
        It's also far from being a better C without costs incurred, even simple runtime costs, let alone everything else.

        Comment


        • #64
          Originally posted by pal666 View Post
          what word you didn't understand?
          I know for a fact that Rust zero-cost abstractions are not 0-runtime cost (at least some of them). So I was wondering about your "no"

          Comment


          • #65
            Originally posted by SledgeHammer_999 View Post

            C++ doesn't enforce the OOP paradigm. You can continue to code like in C AND also take advantage of other goodies, like std::unique_ptr, std::array, std::string_view, std::span, etc which are essentially zero cost and add tremendous safety when compared to the manual/raw manipulation of C.
            You can also use C++ to enforce more type-safety than constantly casting to/from void pointers.

            About the virtual calls. IIRC in modern C++ you are nudged to use templates rather than base/virtual classes. And templates don't have the problem of virtual calls.
            I think your comment implies you missed the point. Yes, you can write cleaner C++ code and it's gotten better in recent days. That doesn't mean people will or do. An argument can also be made that C++ hasn't always encouraged good practice, but rather encouraged bad practices... hence why Linus had a bad attitude towards it. He also implied that there's a systemic problem with the disciplines in C++ programmer communities that caused bad code.

            Comment


            • #66
              Originally posted by computerquip View Post

              Linus didn't have a lot of fault with the language, even then, it was the resulting heavily-abstracted jargon that he did not like. He doesn't trust programmers to emit simple, easy-to-maintain code in C++. The "everything is an object" concept is dangerous in a lot of contexts, including areas that need careful maintenance and areas that need to be performant. Things like making everything virtual is probably one of the dumber things that C++ normalized as well.

              C++ doesn't *have* to be as bad as people who use it make it out to be. I'm not even sure why but in my experience, C++ developers end up with stubborn and wild ideologies that are dangerous in a lot scenarios.
              While I agree with the latter, "everything is an object" is not true for C++ (it's not even true for Java, and that says a lot ...). In fact, the template systems allows you to work quite well with objects and fundamental types (swap them easily). In some circumstances, that may translate into fewer, not more, objects.

              Comment


              • #67
                Originally posted by computerquip View Post

                I think your comment implies you missed the point. Yes, you can write cleaner C++ code and it's gotten better in recent days. That doesn't mean people will or do. An argument can also be made that C++ hasn't always encouraged good practice, but rather encouraged bad practices... hence why Linus had a bad attitude towards it. He also implied that there's a systemic problem with the disciplines in C++ programmer communities that caused bad code.
                When you use C to implement C++-like features you typically end up with worse looking code, and definitely less safe.

                Comment


                • #68
                  Very true, the problem of C++/C is that the compiler doesn't enforce you to use good stuff, unique_ptr etc, and not using the dangerous C pointer.
                  Whatever goodies are brought in by stl templates, many code monkeys are still using many C stuff. Slow and tedious human code review process is required to promote the good over dangerous stuff.

                  Dare they enforce a “Safe C++" mode in compiler to prevent raw pointers? It will be great but will break all existing code, and make people feel really hard to create new code.

                  Comment

                  Working...
                  X