• GHOSCHT@feddit.de
    link
    fedilink
    arrow-up
    65
    arrow-down
    3
    ·
    1 year ago

    Come on. C++ isn’t thaaat bad. It’s actually kind of nice to use coming from C.

    • peopleproblems@lemmy.world
      link
      fedilink
      arrow-up
      41
      arrow-down
      1
      ·
      1 year ago

      It’s actually kind of nice coming from C.

      I’m reading this and all I can think is “yeah, I too would rather lose a limb than let a necrotic infection spread.”

      • Kage520@lemmy.world
        link
        fedilink
        arrow-up
        15
        ·
        1 year ago

        C sucks to write and take care of memory, but it’s nice for super efficient code for use on smart watches. Samsung ditched it (tizen- native apps written in C) in favor of wearOS (java?), and their battery life is now less than half what it was.

          • Rodeo@lemmy.ca
            link
            fedilink
            arrow-up
            3
            ·
            1 year ago

            All this talk of Rust I’m seeing makes me so sad Ada was never given a fair chance.

              • Rodeo@lemmy.ca
                link
                fedilink
                arrow-up
                1
                ·
                1 year ago

                I haven’t used it in a while, so I don’t remember off the top of my head. I guess the main thing is the syntax is much more natural than C-likes. It can be wordy but the flip side is that it’s easier to read and decipher.

                I don’t really think it has a future though. It was released in the 80s and suffers the same constraints from backwards compatibility as any other old language. Also it was intended to run on everything, so they limited the character set, which resulta in round brackets being the only brackets there are, which can lead to ambiguous code where for example you’re not sure if you’re accessing an array or calling a function that has the same name.

                I really want a safe language that has actual nice syntax instead of some gibberish with lots of symbols, and Ada is the closest I’ve found, but she’s old and forgotten now.

          • frozen@lemmy.frozeninferno.xyz
            link
            fedilink
            arrow-up
            5
            ·
            1 year ago

            Holy hell Java on a Smartwatch?

            WearOS is based on Android, which uses Android Runtime (ART) as the application runtime. ART uses Java (or any other JVM-compatible language, such as Kotlin) as the development language, but compiles the app to native code when it’s installed on a client device.

            So… Kind of?

      • CoderKat@lemm.ee
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        1 year ago

        I hate writing code in either language. But at least what C has going for it is that it’s waaaay simpler than C++. Simple can be a really good thing. Sure, all those cool features can save you time, but they can also be gotchas that will cause bugs.

        Though it is a balancing act. Too simple and you’ll make mistakes due to how much you have to repeat yourself or using unsafe equivalents (like using preprocessor directives to mimic features that C++ natively supports).

      • float@feddit.de
        link
        fedilink
        arrow-up
        9
        ·
        1 year ago

        It’s the amount of legacy it’s carrying on that drives me crazy. Many of the implicit default implementations are confusing. That’s where all these “rule of 3”, “rule of 7”, “rule of whatever” come from. The way arguments are passed into functions is another issue. From the call-side you (sometimes) cannot tell if you’ll end up with a moved value or a dangling reference. The compiler will not stop you from using it. Even if the compiler has something to tell you, it’ll do it on the most cryptic way possible. I’m grateful we have C++, it paid lots of my bills. But it’s also a pain in the ass.

      • CoderKat@lemm.ee
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        The most recent C++ thing I worked on (not that recent, like 5 years or so ago) was a fairly new project and the people working on it were really passionate about C++. But it was C++ code that ran as a Python library and was using the official Python C bindings. Not sure why we didn’t use one of the unofficial C++ libraries, but the usage of that C library (and such a fundamental one) held things back. We wrote was was modern C++ (at the time), but big chunks would be a completely different style.

    • qaz@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      1 year ago

      I used COBOL to write a small program, and it’s not so bad either. Bonus is that your standards are lowered so much that Java feels concise.

  • palordrolap@kbin.social
    link
    fedilink
    arrow-up
    53
    ·
    1 year ago

    Caution: Finding something that one hates more than one’s self does not take away the initial self loathing. Attempting to mollify or subdue the lesser by observation or interaction with the latter may result in something greater than the sum of its parts and oh boy, Jeffery Christmas, now we’re in for a bad time.

  • Rooki@lemmy.world
    link
    fedilink
    arrow-up
    54
    arrow-down
    13
    ·
    1 year ago

    Boy oh boy, you gonna hate like a sith if you find out how sh*tty python is.

      • Rooki@lemmy.world
        link
        fedilink
        arrow-up
        17
        arrow-down
        4
        ·
        1 year ago

        The syntax, the syntax-highlighting, venv creation and usage, having to import everything even inbuild types, have fun checking what a third party library has for functions and what they need :D Async is a hecking mess, documentation is another (bad) story.

        • tias@discuss.tchncs.de
          link
          fedilink
          arrow-up
          20
          arrow-down
          1
          ·
          1 year ago

          I’m sure the syntax highlighting is entirely dependent on what editor you use, and is not a property of the language itself.

          • Rooki@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            I used pycharm, vscode ( with some extensions ), text editor, notepad++, IDLE even Thonny on my raspberry PI. Still all of them was syntax highlighting or suggestion terrible. I never knew what the function of a third party or sometimes first party library wanted.

  • DharkStare@lemmy.world
    link
    fedilink
    English
    arrow-up
    31
    arrow-down
    1
    ·
    1 year ago

    Although I haven’t used it since college, I actually liked C++ especially once I understood pointers.

    • wim@lemmy.sdf.org
      link
      fedilink
      arrow-up
      37
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Everything is fine within the scope of a college course or project.

      Where C++ breaks down is large, complicated projects where you colaborate with other developers over multiple years.

      I worked in C++ for almost a decade, and while there were a few good projects I encountered, most suffered from one or more of the following problems:

      • C++ has so many parts, everyone picks a subset they think is “good”, but noone seems to fully agree on what that subset is.
      • A side effect of the many possibilities C++ offers to compose or abstract your project is that it allows for developers to be “clever”. However, this often results in code that is hard to maintain or understand, especially for other developers.
      • Good C++ is very hard. Not everyone is a C++ veteran that read dozens of books or has a robust body of knowledge on all its quirks and pitfalls, and those people are also often assigned to your project and contribute to it. I was certainly never an expert, despite a lot of time and effort spent learning and using C++.
      • 257m@lemmy.ml
        link
        fedilink
        arrow-up
        11
        arrow-down
        1
        ·
        edit-2
        1 year ago

        Just use C. It solves all those problens given the most complicated feature is pointers and those hard aren’t to understand.

        • wim@lemmy.sdf.org
          link
          fedilink
          arrow-up
          6
          arrow-down
          1
          ·
          1 year ago

          While C is certainly better for some problems in my experience, it too is very hard to use in large projects with a mix of developers, and it is unsuitable for most higher level applications in most companies.

          I think C has its place in the world still, which is mostly confined low level embedded, kernel space and malware. I do believe that the market segment that used to rely on C++ is today better served by either Go or Rust, depending on the project.

          That said, while I LOVE working with Rust, it suffers from many of the same issues I mentioned for C++ in my comment above when working in a mixed skillset team.

          • 257m@lemmy.ml
            link
            fedilink
            arrow-up
            4
            ·
            1 year ago

            I agree, unless you doing low level stuff where you need absolute control you should use a modern language with proper abstraction just to save time. Most use cases where they use C++ can be replaced with Rust or Go as they aren’t saddled with years tech debt and bloat due to having mantaining backwards compatibility.

  • YⓄ乙 @aussie.zone
    link
    fedilink
    English
    arrow-up
    23
    ·
    1 year ago

    My dad wanted to me to become a developer. He bought me a computer so that I can code but instead I was introduced to the world of porn. Today I am successful Porn director who has worked for many big name companies.

    Thanks dad🥰

  • Zink@programming.dev
    link
    fedilink
    arrow-up
    19
    ·
    1 year ago

    I am almost a year into a job where the main piece of software is a mix of C and C++ and there is no documentation, hardly even code comments. Some of the files say they were created over a decade ago. Just pages and pages of C code with no comments and no external design docs.

    If I search my local copy of the source for .c and .cpp files, I get 1,485 items. But it’s not that bad because many files show up several times in different directories with the same name. :D

    And you know, I HAVE been feeling better about myself lately! (The job is actually a perfect fit for me, other than the humongous scary & opaque code base)

  • ______@lemm.ee
    link
    fedilink
    arrow-up
    13
    ·
    1 year ago

    I love and hate C++ it’s my self abuse love language.

    Love: wow I’d like to make a project that does Y in cpp. Abuse: actually working on it.

  • dylanTheDeveloper@lemmy.world
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    edit-2
    1 year ago

    As someone who switches between C++ and C and besides classes and inheriting what’s the actual difference between native C++ and C? Never really explored beyond Unreals macro heavy version of C++, wxwidgets and QT

    • Chobbes@lemmy.world
      link
      fedilink
      arrow-up
      12
      ·
      1 year ago

      C++ is technically a completely different programming language to C, but they share a lot of similarities because C++ is sort of derived from C (and now they’ve both evolved somewhat separately). The main addition at the start was OOP being baked in to C++. A typical C program is often a valid C++ program as well, but there are some subtle differences in a few areas that can cause problems. C++ has a lot of features compared to C, a more complex type system, a big templating system for compile-time computation, and focuses a lot on adding low/no cost abstractions to make writing programs easier without incurring a high cost at run-time… That said many people do still prefer C, often for its simplicity in comparison.

    • TopRamenBinLaden@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      9
      arrow-down
      2
      ·
      edit-2
      1 year ago

      C++ is a superset of C, and C is a subset of C++. C++ was originally designed for the purpose of updating and adding OOP to C.

      The main things C++ has that C doesn’t are user defined data types, support of reference variables, function overloading/overriding, built in exception handling with try/catch, inline functions, and C++ has around 30 more keywords overall.

      I would say the biggest difference is the OOP focus of C++ where all of data and functions are encapsulated into an object. This helps make C++ more secure and better for writing high level implementations than C.

      • dylanTheDeveloper@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        1 year ago

        Ahh so the whole create a object from a class thing actually works in native C++. So I can create child classes aswel and do cool stuff like casting.

        Don’t laugh okay I thought C++ through Unreal Engine was vastly different from native C++ (because that’s what I learnt first)

        Never actually used classes when I was playing with native C++. Couldn’t think of anything simple to make that would require it

  • ThatFembyWho@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Yeah the constant stream of critical CVEs affecting C/C++ libraries that get patched on my computer is legitimately frightening. So much low quality (and dangerous) code out there. Maybe if you have a personal project that doesn’t connect to another device… you could be justified in writing C code. Or tiny embedded systems?

    Modern C++ is actually pretty good. The language gets knocked firstly because it’s complex, and secondly a lot of people remember the old pre-C++11 days. It’s like a different language now.

    But it’s a looong way from being my favorite language. That goes something like Python… by a lot; Rust; JavaScript; C# and then everything else.

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    4
    ·
    1 year ago

    I’m happy so many people despise C and C++. Maybe we can move on from it someday and use more memory safe languages that are easier to read. Languages with usable package managers, linting, documentation generation, IDEs, embedded debuggers, helpful stacktraces, readable errors, sane standard libraries, with less arcane invocations of evil.

    Honestly, I hope the linux kernel manages to be rewritten in Rust someday.