C++: A language for chads

C++: A language for chads

Beware Cat Shirt $21.68

Rise, Grind, Banana Find Shirt $21.68

Beware Cat Shirt $21.68

  1. 2 weeks ago
    Anonymous

    >hurr durr we got std::expected we just as good as Rust now
    std::expected<std::array<int, 1000>, int> foo() {
    std::array<int, 1000> result = {};
    if (rand() % 2 == 0)
    return std::unexpected(-1);
    return result;
    }

    >causes an extra copy of result
    >how you're supposed to do it to avoid the extra copy:
    std::expected<std::array<int, 1000>, int> baz() {
    std::expected<std::array<int, 1000>, int> result;
    if (rand() % 2 == 0)
    result = std::unexpected(-1); // note the assignment operator
    return result;
    }

    I swear I'm fricking done with this language, they frick up everything.

    • 2 weeks ago
      Anonymous

      >returning array of int by value
      try that in C at all

      • 2 weeks ago
        Anonymous

        you can't do that in C because you can't return array of ints, its always cheap trick of moving the return value to function argument as reference during compile time, C won't lie to you

        • 2 weeks ago
          Anonymous

          It's because of array decay, which only exists for backward compatibility with B. And C does let you return arrays by value regardless, you just have to wrap them in a struct

          • 2 weeks ago
            Anonymous

            >It's because of array decay, which only exists for backward compatibility with B
            actually it exists because by not having the array size be part of its type you allow for a limited degree of parametric function reuse without butt fricking an otherwise simple type system.

          • 2 weeks ago
            Anonymous

            We know it was for backward compatibility, it's on the record from Ritchie himself. https://dl.acm.org/doi/10.1145/155360.155580 page 7 lays out the exact evolution.
            If you want to pass a pointer to the first element you can just pass a pointer to the first element, you really don't need the language to force you into this.

            The absolute madman.
            [...]
            [...]
            [...]
            Wat. You can absolutely can return an array, provided it has a self-terminating mechanism or known length.
            The array pointer is the same as the pointer to the first element.
            Depending what data type it dereferences to, the pointer arithmetic in addressing that return memory address will be handled in the same way as when you index an element using square brackets.
            No, C cannot return an array by value, but many other languages that do, don't either, it's just syntactic sugar for having array pointers handled by the interpreter or JIT compiler.

            You can return an array by value and I even told you how to do it in C

          • 2 weeks ago
            Anonymous

            >https://dl.acm.org/doi/10.1145/155360.155580
            Not that anon but cool link, thanks.

          • 2 weeks ago
            Anonymous

            >You can return an array by value and I even told you how to do it in C [i.e. wrapping in struct]
            How does that fit in the return register?
            Is it not just syntactic sugar of C for handling the struct's pointer in this case?

          • 2 weeks ago
            Anonymous

            Regardless, the underlying root issue is that you shouldn't be passing things around functions in C by value unless they are simple primitives.

            You either have a struct somewhere in memory and tell the function where it is and it "fills" it out with its processed data, have a function that returns a pointer to its read-only internal static buffer (the buffer itsel is not read-only but the pointer supposedly points to something constant) or you create a struct in heap and return that by pointer, which is basically the constructor method for creating typedef'ed "objects" in C, and these are the ones you must not forget to free() after using.

            It's this what most people struggle to understand about C and, even worse, deem "unsafe," because they don't understand that the very thing that makes C ultra fast is this efficiency, but that it has its drawbacks, like everything else, namely catastrophic error if you try to dereference a null pointer (though only by design; there is no actual reason it shouldn't be able to do that on the very first memory byte with address 0x0).

            C has its own set of problems, but its the closest abstraction that's practically usable of how a computer does things.
            You cannot replace it; that ship has sailed.

          • 2 weeks ago
            Anonymous

            If it's too big it's passed through the stack. Same goes for structs with enough fields.
            Arrays in structs are true arrays, and this was the original reason arrays became real types and not just syntax for reserving stack memory. See the link.

            Regardless, the underlying root issue is that you shouldn't be passing things around functions in C by value unless they are simple primitives.

            You either have a struct somewhere in memory and tell the function where it is and it "fills" it out with its processed data, have a function that returns a pointer to its read-only internal static buffer (the buffer itsel is not read-only but the pointer supposedly points to something constant) or you create a struct in heap and return that by pointer, which is basically the constructor method for creating typedef'ed "objects" in C, and these are the ones you must not forget to free() after using.

            It's this what most people struggle to understand about C and, even worse, deem "unsafe," because they don't understand that the very thing that makes C ultra fast is this efficiency, but that it has its drawbacks, like everything else, namely catastrophic error if you try to dereference a null pointer (though only by design; there is no actual reason it shouldn't be able to do that on the very first memory byte with address 0x0).

            C has its own set of problems, but its the closest abstraction that's practically usable of how a computer does things.
            You cannot replace it; that ship has sailed.

            Passing small structs by value is fine.
            malloc()ing individual objects is not particularly efficient. (malloc is a pretty high-level interface that leaves efficiency on the table. C23 finally added free() alternatives that let you pass size and alignment. Often you'll want to bypass it altogether and manage your own allocations.)
            Null pointers don't have a lot to do with efficiency. Marking pointers as non-nullable could happen at the type level, pure compile time. I'm 90% sure they did it the way they did because it keeps the language simpler. (Yeah, rarely you actually do want to access 0x0, but you can build escape hatches for these cases.) Go (by some of the same people) isn't too concerned with efficiency but is full of null values.
            Null pointer dereferences also aren't one of the biggest safety hazards. They can cause crashes, and nowadays bad compiler optimizations, but unlike out-of-bounds access and use-after-free and friends they don't corrupt memory. The bad behavior is bounded.

          • 2 weeks ago
            Anonymous

            You have no idea what you are talking about and I'm not giving any more lessons for free.

          • 2 weeks ago
            Anonymous

            Don't worry about it, teaching you that structs can have array members was a freebie.

          • 2 weeks ago
            Anonymous

            You're arguing about technical details that are implementation specific, not the metaphysical reality of C that pass by value is technically redundant (and less efficient!) for any primitive wider than a memory address.

          • 2 weeks ago
            Anonymous

            Structs can be smaller than that. Even some arrays are smaller than that. And I only advocated passing small structs by value.
            A value can be larger than a pointer and still fit in (multiple) registers. If it's passed entirely through registers then that's probably faster than using a pointer (which requires the value to live in memory so it can have an address, except when the compiler sees through it and optimizes it all away).

          • 2 weeks ago
            Anonymous

            Yes, but you're checking this at compile or at runtime for a most of the time very minimal trade-off.
            It makes sense in certain situations, but the *general* rule-of-thumb is use a pointer for non-primitives.
            Everything else is just optimization for a specific technical use-case.

          • 2 weeks ago
            Anonymous

            That's a fine way to do things, sure.

          • 2 weeks ago
            Anonymous

            Absolutely not. If arrays decayed to pointers inside struct, it would require structs to have non-trivial constructors. Which goes against everything C.

          • 2 weeks ago
            Anonymous

            You too fail to understand

            You're arguing about technical details that are implementation specific, not the metaphysical reality of C that pass by value is technically redundant (and less efficient!) for any primitive wider than a memory address.

            .
            Python is just syntactic sugar for C, in turn syntactic sugar for ASM, etc.
            These different levels of abstraction allow you to program according to "I can expect this and this output exactly given this input".
            The implementation of it is a technicality.
            You should avoid pass by value in C for anything bigger than a memory address unless you're forced to do so by working on existing code that requires it.

          • 2 weeks ago
            Anonymous

            Bro I corrected you on something you were factually wrong about. Don't start yapping about metaphysics like a tard.
            Sometims returning a big struct by value is the correct choice, and it's actually more efficient than mallocing the struct inside your function and freeing later, since the struct will not be copied, but instead built directly in it's consumer site.

          • 2 weeks ago
            Anonymous

            C is kind of like syntactic sugar for ASM but I don't think it's productive to analyze Python this way, an interpreter is not a compiler
            Array members in structs affect semantics, it's not an implementation detail

        • 2 weeks ago
          Anonymous

          No you fricking moron, RVO absolutely applies in C
          https://godbolt.org/z/MKEW7hGx3

        • 2 weeks ago
          Anonymous

          >wannabe C groupie doesn't understand the as-if rule

        • 2 weeks ago
          Anonymous

          >you can't do it in C
          >so it's impossible
          >C wouldn't lie to you, r-right guys?
          Lmao blind cnile

      • 2 weeks ago
        Anonymous

        just wrap it in a struct

    • 2 weeks ago
      Anonymous

      Templates are cancer.
      You can't kill cancer with cancer.

      • 2 weeks ago
        Anonymous

        This has nothing to do with the template type and everything to do with objects lifetimes. In the first code, the lifetime of result overlaps the lifetime of the std::unexpected(-1). So GCC can't do NRVO or something. What a blunder again.

        • 2 weeks ago
          Anonymous

          It also has nothing to do with std::expected either, you are copying a stack allocated array in to an std::expected before returning it and then the copied return value gets RVO'ed. That's how it's always worked, you are returning an array and then invoking the converting constructor for expected with a type where the move constructor has to copy anyways.

        • 2 weeks ago
          Anonymous

          Have templates ever been able to do anything useful that structs can't already do? I mean for single coders, not for large corporations with megadumbshit.

          • 2 weeks ago
            Anonymous

            example?

          • 2 weeks ago
            Anonymous

            Of course. Expression templates are invaluable for anything linear algebra related.

          • 2 weeks ago
            Anonymous

            >Expression templates
            Yeah, those don't offer anything to the individual coder. Having math-looking function calls is a very stupid idea. Nothing is improved.

            >if I need to add n arrays, I have to use templates

            oh really, you think you are the first person to add arrays, you really dying on that hill?

          • 2 weeks ago
            Anonymous

            I think you just googled "expression templates" and didn't really understand the point.
            How would you achieve loop fusion at compile time without expression templates, in a simpler way?

        • 2 weeks ago
          Anonymous

          >objects lifetimes
          When did we stop using smart pointer and letting the compiler optimize it away?

          • 2 weeks ago
            Anonymous

            It turned out it's not allowed to optimize smart pointers away. Pointers are objects and the Itanium ABI mandate that they have a stack address.

      • 2 weeks ago
        Music trigger you

        >You can't kill cancer with cancer.
        https://news.harvard.edu/gazette/story/2023/01/in-mouse-model-scientists-develop-cancer-vaccine-that-kills-brain-tumors/

        • 2 weeks ago
          Anonymous

          >harvard
          heh

          heheheheheh

          does anyone want to tell him?

    • 2 weeks ago
      Anonymous

      an extra copy of result
      Not C++'s fault if you've never heard of copy elisions in your life.

      • 2 weeks ago
        Anonymous

        This is a hole in copy ellision. Copy ellision requires the return to be trivially copyable from what was returned. It doesn't work for cases where there is a conversion ctor (from returned type to return of the function) that does trivially copy the passed value, but also does something else (or the type has extra memory not sure), like how std::expected sets it's own metadata

        • 2 weeks ago
          Anonymous

          How come people can't read my post? Read my original post again. The second snippet does copy elision perfectly. It's not because of the value_type -> result conversion.

          • 2 weeks ago
            Anonymous

            How come people can't read my post? Read my original post again.
            >The second snippet does copy elision perfectly.
            And the first one doesn't, exactly, that's the problem, it should
            >It's not because of the value_type -> result conversion
            It is, literally the thing that changed from the first example, which DIDN'T elude was the return type.
            It gets eluded because the value type in the return statement is the same as the return type.

          • 2 weeks ago
            Anonymous

            Read the examples again, the return type is the same...

          • 2 weeks ago
            Anonymous

            Read the post again
            >the value type in the return statement
            >the thing that changed from the first example, (...) was the return type
            Missed an "ed" in the second quote

          • 2 weeks ago
            Anonymous

            See

            Wrrrrrrrong
            std::expected<std::array<int, 1000>, int> bar() {
            std::expected<std::array<int, 1000>, int> result;
            if (rand() % 2 == 0)
            return std::unexpected(-1);
            return result;
            }

            Still causes a copy.
            Get how shitty that is, yet?

            Simply changing result to a std expected doesn't make RVO work. The important part is that you have to mutate result rather than do an early return with a std::unexpected.
            Note that I understand why you would think what you think. It's what would make sense. But unfortunately, as often, it doesn't.

    • 2 weeks ago
      Anonymous

      >they frick up everything
      Ah okay so you're clearly giga IQ.
      What would you have proposed for introducing std::expected without breaking backward compatibility or requiring a fundamental change to the C++ language?

      • 2 weeks ago
        Anonymous

        Doing whatever LLVM did?
        It doesn't trigger an extra copy in clang.

        an extra copy of result
        Not C++'s fault if you've never heard of copy elisions in your life.

        The point is it doesn't do it.

        It also has nothing to do with std::expected either, you are copying a stack allocated array in to an std::expected before returning it and then the copied return value gets RVO'ed. That's how it's always worked, you are returning an array and then invoking the converting constructor for expected with a type where the move constructor has to copy anyways.

        >That's how it's always worked,
        There is zero reason for NRVO to not apply here.

        • 2 weeks ago
          Anonymous

          Ah so your "they" was referring to the GCC implementers.
          I thought you were dogpiling on the standards committee and library working group for the design of std::expected.
          Yes, gcc has been shoddy lately.

        • 2 weeks ago
          Anonymous

          >There is zero reason for NRVO to not apply here.
          Yes there is. The reason is because the return type is std::expected and you are returning std::array. Thus you are returning an unnamed temporary and unnamed RVO applies.

          • 2 weeks ago
            Anonymous

            You don't understand. See example 2. Building the return value with a value_type doesn't have to trigger a copy.
            It would be quite shitty and moronic if the only way to use expected was to use .emplace everywhere.

          • 2 weeks ago
            Anonymous

            Makes no sense. The standard clearly says what should happen, if there is an additional optimization that can be done and the result is as-if then it has nothing to with the language itself take it up with the compiler.

          • 2 weeks ago
            Anonymous

            Copy elision allows side-effect changes

          • 2 weeks ago
            Anonymous

            >Makes no sense.
            What makes no sense? That we should be able to expect both codes to do the same thing?
            >The standard clearly says what should happen,
            It does not.

          • 2 weeks ago
            Anonymous

            Wrrrrrrrong
            std::expected<std::array<int, 1000>, int> bar() {
            std::expected<std::array<int, 1000>, int> result;
            if (rand() % 2 == 0)
            return std::unexpected(-1);
            return result;
            }

            Still causes a copy.
            Get how shitty that is, yet?

    • 2 weeks ago
      Anonymous

      What is the point of this expected/unexpected shit? Just to add more noise and make your code just a bit less readable?

      • 2 weeks ago
        Anonymous

        The point is exceptions fricking suck.

    • 2 weeks ago
      Anonymous

      i hate c++. Im done with languages that auto copy shit

    • 2 weeks ago
      Anonymous

      >brainlet doesn't understand RVO and value semantics

      • 2 weeks ago
        Anonymous

        And yet clang optimizes it correctly.
        Looks like you're the only brainlet here.

    • 2 weeks ago
      Anonymous

      FPMP holy shit sepple cucks can't stop malding

    • 2 weeks ago
      Anonymous

      What the FRICK was the point of having this std::expected shit when there already was std::variant with the same semantics?

      • 2 weeks ago
        Anonymous

        Handling std variants is very cumbersome.
        Having monadic types means you can have all the usual .value_or_else(), .value_or_die(), value_unsafe(), .apply(), .transform() and so on.

    • 2 weeks ago
      Anonymous

      https://godbolt.org/z/j1oh3PMKe I can't recreate this at all. Note that the sizeof won't change for an unexpected value (the 4000 magic number everywhere), and it branches early in foo, so even though the function is longer it's still only doing what's necessary in both functions and is only a reordering of operations compared to baz.

      • 2 weeks ago
        Anonymous

        Clang does it right. It's just GCC that fricks it up. As someone else noted earlier, it's not a standard committee error, it's a Ganoo frickup.

  2. 2 weeks ago
    Anonymous

    I'm too brainlet to understand that clusterfrick

    • 2 weeks ago
      Anonymous

      It's poorly formatted, revealing the organizational weakness of the creator.
      I wouldn't trust him as a janitor

    • 2 weeks ago
      Anonymous

      this is a garbage clusterfrick made by actual morons. nothing in this is actual programming and it's only for these people to jerk off each other while thinking how evolved they all are

  3. 2 weeks ago
    Anonymous

    its a troony language

    • 2 weeks ago
      Anonymous

      why are there so many of "them" in tech

      • 2 weeks ago
        Anonymous

        Some species go from male to female if there is a lack of them in their environment. It being a tech sector issue would make perfect sense, then.

        • 2 weeks ago
          Anonymous

          thats actually one of the best explanations Ive ever heard from a sociological pov.

        • 2 weeks ago
          Anonymous

          >go male to female
          probly more like a prison-gay thing

      • 2 weeks ago
        Anonymous

        autism

      • 2 weeks ago
        Anonymous

        its easier to get attention from tech nerds if you are remotely a female

      • 2 weeks ago
        Anonymous

        AGP correlates with high IQ and autism.

        • 2 weeks ago
          Anonymous

          >AGP correlates with high IQ and autism.
          Is it high iq to make the fundamental mistake of saying a boy is a girl? If youre a high iq programmer, you should know how to do logic gates.

          • 2 weeks ago
            Anonymous

            Eh, they're making the best out of a bad situation. If you had gender dysphoria, maybe you would do it too.

          • 2 weeks ago
            Anonymous

            >If you had gender dysphoria,
            No one who is smart believes in gender dyspohoria.

            Just call them moronic.

          • 2 weeks ago
            Anonymous

            Gender dysphoria is a real thing, but the percentage of people affected by it are vastly less than the one you see in internet everyday.
            Unfortunately nowadays anyone who wants some crumb of attentions self.diagnose gender dysphoria and somehow get a pass to go to sex reassignment surgery. It's a sad world we live in.

          • 2 weeks ago
            Anonymous

            Gender isn't real, anon

          • 2 weeks ago
            Anonymous

            Doesn't ROGD affect AFABs only?

          • 2 weeks ago
            Anonymous

            Why would it? It would mean that all those trannies we see online have gone through a psychologist, got a REAL diagnosis from a professional (although I don't have datas to see if psychologists have bias towards giving dysphoria diagnosis), but this is in stark contrast to the statistics

            https://pubmed.ncbi.nlm.nih.gov/28838353/
            >Recent studies suggest that the prevalence of a self-reported transgender identity in children, adolescents and adults ranges from 0.5 to 1.3%, markedly higher than prevalence rates based on clinic-referred samples of adults. The stability of a self-reported transgender identity or a gender identity that departs from the traditional male-female binary among non-clinic-based populations remains unknown and requires further study.

          • 2 weeks ago
            Anonymous

            >Gender dysphoria is a real thing,
            No it isnt.

          • 2 weeks ago
            Anonymous

            The only bright spot is they're selecting themselves out of the gene pool. But yeah it's all very sad. I wish I could push a button and make everyone happy without some monkeys paw shit like turning them into doped up zombies. I wish the boomers had cared about their kids and had tried to fix things.

          • 2 weeks ago
            Anonymous

            Nah. I got molested and have completely moronic fetishes but I choose to be normal (or at least only act on normal impulses) since my wife would cry (along with feeling inadequate etc.) if she knew what I secretly wanted her to do to me. It's not that hard if you aren't a narcissistic piece of shit who thinks the world should bend over backwards to make you feel "comfortable". It's better to have a nice day than to try to externalize your own insanity.

          • 2 weeks ago
            Anonymous

            Respectable.

          • 2 weeks ago
            Anonymous

            Your wife will never be a woman.

          • 2 weeks ago
            Anonymous

            You can be intelligent and totally fricking nuts and detached from reality, moron. Intelligence guarantees neither coherence nor an emotional attachment to rationality/empiricism.

      • 2 weeks ago
        Anonymous

        Modern problems require modern solutions. We need to even out the gender ratio in tech, but it turns out that getting non-autistic women genuinely interested in programming is close to impossible. It's easier to turn men into women than to make women program.

      • 2 weeks ago
        Anonymous

        only way to have more women in STEM fields

    • 2 weeks ago
      Anonymous

      think again

  4. 2 weeks ago
    Anonymous

    Praise death.

  5. 2 weeks ago
    Anonymous

    keep coping homosexuals
    someday you'll find the real chad lang
    >picrel

    • 2 weeks ago
      Anonymous

      What language is the BEAM VM implemented in?

      • 2 weeks ago
        Anonymous

        Are you a BEAM maintainer?

        • 2 weeks ago
          Anonymous

          No, but somebody needs to do it. And if the language they use for BEAM is the right tool for that job it's probably also the right tool for other jobs.

          • 2 weeks ago
            Anonymous

            ????
            Ok.
            What does it have to do with what he said?

      • 2 weeks ago
        Anonymous

        it is implemented in mostly c, but the beam vm just a part of the erlang real time system, which is also mostly written in c, but the otp which are the libraries for erlang are written in erlang.

    • 2 weeks ago
      Anonymous

      Posted wrong image, sorry.

    • 2 weeks ago
      Anonymous

      BASED

      Posted wrong image, sorry.

      Just use LFE. Or elixir, if you don't mind syntactic sugar covering up the raw AST. It has the same kind of macros and metaprogramming otherwise.

      What language is the BEAM VM implemented in?

      A deprecated language from the 80s that no one sane chooses to write serious software in anymore

  6. 2 weeks ago
    Anonymous

    It's that a man or woman

    • 2 weeks ago
      Anonymous

      Most masculine polish male

      • 2 weeks ago
        Anonymous

        do polish men eat estrogen?

      • 2 weeks ago
        Anonymous

        do polish men eat estrogen?

        Hey, not true! Polish men aren't feminine! It's Asian men who are feminine.

        • 2 weeks ago
          Anonymous

          Slavs are racially asians

  7. 2 weeks ago
    Anonymous

    i hate programming

    • 2 weeks ago
      Anonymous

      She looks so pure and innocent, I bet her dad is proud of her!

  8. 2 weeks ago
    Anonymous

    How many const semantic do you want in your language?
    Yes.

    • 2 weeks ago
      Anonymous

      I don't think anybody actually uses consteval or constinit. Consteval is just there to technically fill in the hole they made by making constexpr not actually force constexpr. I really have no idea why you would ever need constinit, even if it's cool.

      • 2 weeks ago
        Anonymous

        >I really have no idea why you would ever need constinit,
        When you want to initialize something at compile time but still have it mutate.
        Seems like a pretty common use-case now that I think about it.

        • 2 weeks ago
          Anonymous

          I get that. But it only works with global variables and static class members anyway as far as I can tell. I cannot think of a single example where you need a huge, expensive-to-initialize global variable which also needs to be mutable. Maybe ELF has a way to fix it, but you're also bloating the final executable I assume. I feel like if you've arrived at this problem, you already fricked up somewhere else.

          Maybe this is just my stupid gay take, but I think if you're using mutable global variables for anything other than MMIO in embedded devices (or anything else that inherently has global side-effects), you have already fricked up.

          • 2 weeks ago
            Anonymous

            > I cannot think of a single example where you need a huge, expensive-to-initialize global variable which also needs to be mutable
            Logger.
            Global mutex array.
            Arena.

          • 2 weeks ago
            Anonymous

            The most expensive part of initializing the logger is the file I/O. I guess the global mutex array can be useful sometimes, but I really think you should put your mutexes inside of objects. God gave us classes for a reason. I didn't think about an arena though, that's a good point

          • 2 weeks ago
            Anonymous

            Right, an important thing to note about constinit is that it's not really about "doing more work at compile time for performance reasons" (unlike constexpr), it's mostly about ensuring proper constant initialization of all those global variables. The main use-case is avoiding a very nasty type of bug: https://isocpp.org/wiki/faq/ctors#static-init-order

    • 2 weeks ago
      Anonymous

      Const semantics are great and I wish Rust had more of it.

    • 2 weeks ago
      Anonymous

      Someone will probably wrote a book about the const semantics.

  9. 2 weeks ago
    Anonymous
  10. 2 weeks ago
    Anonymous
  11. 2 weeks ago
    Anonymous

    These giant conferences are so fricking gay and corporate, literally nothing cozier than programming in an irc channel with some bros or via mailing list, this shit is absolutely soulless in comparison. Imagine going from bell labs and bedroom ZX speccy coders to this shit.

    • 2 weeks ago
      Anonymous

      >irc channel with some bros or via mailing list

      How to find such a community?

      • 2 weeks ago
        Anonymous

        Unironically go look at Linux distros or open source programs, all the rizon channels are dead. Yeah you won’t be able to scream troon in there but it’s better than nothing. Otherwise it’s discord these days.

  12. 2 weeks ago
    Anonymous

    Cute boy. Wish he was my C++ bf.

  13. 2 weeks ago
    Anonymous

    I try to stay away from the STL as much as possible.

  14. 2 weeks ago
    Anonymous

    From the moment I understood the weakness of memory management, it disgusted me. I craved the strength and certainty of Rust. I aspired to the purity of the Blessed Crab. Your kind cling to your pointers, as though they will not reference freed memory and fail you. One day the crude industry you call software development will wither, and you will beg my kind to save you. But I am already saved, for the Crab is immortal... Even in death I serve the borrow checker.

    • 2 weeks ago
      Anonymous

      what kind of dog is that?

      • 2 weeks ago
        Anonymous

        The exoskeleton kind what climbs trees and has a pair of bolt cutters for hands.

        • 2 weeks ago
          Anonymous

          I wish my dog had bolt cutters for hands
          I wish I had a dog

  15. 2 weeks ago
    Anonymous

    The reason C still exists and Rust exists is because C++ is an enormously bloated mess of half-baked ideas and irreducible complications. At so many organizations C++ is completely self defeating. It's not portable bc some doofus wanted to use some feature of boost 1.81 or whatever and then oh crap the cross compiler for the radiation hardened 32 bit arm platform they target's doesn't fully adhere to the whatever standard, yada yada, so it takes some people weeks to figure it all out, then ultimately find that it's better just to give up.
    C++ is fine if you know the one-and-only target platform, you strictly adhere to the most recent language standard, and have at least a few people on the team whose professional identity before anything else is "I'm a C++ grandmaster".

  16. 2 weeks ago
    Anonymous

    I watched this video when it came out, the guy just went though the whole list with a straight face and went on like nothing happened.

    • 2 weeks ago
      Anonymous

      The absolute madman.

      you can't do that in C because you can't return array of ints, its always cheap trick of moving the return value to function argument as reference during compile time, C won't lie to you

      It's because of array decay, which only exists for backward compatibility with B. And C does let you return arrays by value regardless, you just have to wrap them in a struct

      >returning array of int by value
      try that in C at all

      Wat. You can absolutely can return an array, provided it has a self-terminating mechanism or known length.
      The array pointer is the same as the pointer to the first element.
      Depending what data type it dereferences to, the pointer arithmetic in addressing that return memory address will be handled in the same way as when you index an element using square brackets.
      No, C cannot return an array by value, but many other languages that do, don't either, it's just syntactic sugar for having array pointers handled by the interpreter or JIT compiler.

      • 2 weeks ago
        Anonymous

        However, the return value for the SysV ABI is in RAX, but you can't fit an array in a register. So if the return value doesn't fit in a register, then the function is rewritten so that the first argument is a pointer to that type, and the callee just modifies that and returns a pointer to it.

      • 2 weeks ago
        Anonymous

        you can return anything by pointer, but its not the same thing

        No you fricking moron, RVO absolutely applies in C
        https://godbolt.org/z/MKEW7hGx3

        not real world example at all

        • 2 weeks ago
          Anonymous

          >get absolutely destroyed
          >hurr gnuu it's just a simple example
          Of course it's a simple example you fricking moron, the point is to show a minimal example where RVO applies in C.

  17. 2 weeks ago
    Anonymous

    I love C++ for it's power, abilities, and low cost abstraction, but gosh dang it unless you restrict feature use or unless you and everyone else are willing to learn what elision is, it will cause problems.
    People say that C is how computers think, that's wrong, C++ is where you think like a modern computer.

    • 2 weeks ago
      Anonymous

      And don't even get me started on how it's mangled names cause issues with foreign function interfaces.

    • 2 weeks ago
      Anonymous

      no such thing as a low cost abstraction. there's a reason applications written in hand rolled assembly are still blazes faster than anything more than slightly trivial spat out by an optimizing compiler.

      • 2 weeks ago
        Anonymous

        AFAIK big ones aren't. The optimizer can do better than you. But small parts you should still optimize. If hand rolled assembly becomes necessary go for it.

        • 2 weeks ago
          Anonymous

          Optimizers can be very clever in pretty narrow ways, there's a lot they don't understand. They are particularly bad at reasoning at a bigger scale, at performing optimizations that affect the whole program. (Somebody on IQfy posted about keeping certain data in specific registers for the entire program so that any function could work with it at any time with minimal overhead, and that blew my mind a little. Compilers don't do that sort of thing.)
          I think the problem for bigger applications isn't so much that the optimizer is smarter than you, with a deep enough understanding and skill you can get past that, it's that managing the complexity is too hard. It's nice to not have to manually track types and structs and registers and the stack. C already gives you a lot of tools to keep track of and automate these, to offload reasoning to the compiler, and C++ and Rust give you even more.
          t. does not write assembly but tries to look at godbolt every now and then

          • 2 weeks ago
            Anonymous

            (me)
            Oh yeah, I took a screenshot of the post. Really made things click at the time

          • 2 weeks ago
            Anonymous

            That makes sense, though C does have a way to tell the compiler that your pointer isn't aliasing anything. But in general, I find it a bit weird that there aren't more widely used optimizer hints (such as "this loop will only run a few iterations at most"). It's also a bit weird that optimizers and static analyzers are separate. It would make a lot of sense to have a general program analysis framework used by both, and with support for plugins that let you add your own checks or assertions.

          • 2 weeks ago
            Anonymous

            >But in general, I find it a bit weird that there aren't more widely used optimizer hints (such as "this loop will only run a few iterations at most").
            It's very common in HPC, (pragma loop_count in Intel HPC Toolkit), but worrying about this kind of stuff requires an IQ over your average loop count and most programmers don't have the kind of performance constraints to get into it. And even if you do have performance needs, you won't outperform an off-the-shelf library without years of efforts.

          • 2 weeks ago
            Anonymous

            (me)
            Oh yeah, I took a screenshot of the post. Really made things click at the time

            GCC accepts global register variables, no need for ASM

          • 2 weeks ago
            Anonymous

            Neat, first time I'm hearing about this
            https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html
            A local code search doesn't turn up a lot of matches besides GCC itself but it is used in a few language interpreters at least

          • 2 weeks ago
            Anonymous

            It's used in the Linux kernel to implement current for the ARC architecture.

          • 2 weeks ago
            Anonymous

            >implement current
            Didn't know what this meant but it seems to be a pointer to the current task (i.e. thread). Same trick is used on SPARC, OpenRISC, Microblaze, Hexagon. But I can't find it used for anything else

  18. 2 weeks ago
    Anonymous
    • 2 weeks ago
      Anonymous

      His talk was cool too.

  19. 2 weeks ago
    Anonymous

    I hate this shota with all my guts

    • 2 weeks ago
      Anonymous

      Why? What did the shota do?

  20. 2 weeks ago
    Anonymous

    I just use this tree as a custom action in the chatgpt-api and never have to use my brain ever again

  21. 2 weeks ago
    Anonymous

    I don't understand why you need all that mumbo jumbo. pass primitives by value and structs/objects by reference/pointer, end of story

  22. 2 weeks ago
    Anonymous

    I’ve been a python/javascript onions dev for years and finally decided to learn c++

    Given my experiences this is seriously the god language

    Through it all things are possible

    I love c++

    • 2 weeks ago
      Anonymous

      >Through it all things are possible
      Not until we get metaclasses.

    • 2 weeks ago
      Anonymous

      Same. Learning C++ for pleasure, writing Python for money.
      I appreciate the elegance of Python even more now, it makes so many things possible with such a simple syntax.

      • 2 weeks ago
        Anonymous

        Python and C can be pretty useful together. (C++ too, but I tend to avoid that language these days.)

        • 2 weeks ago
          Anonymous

          NTA but I can see why is so hated nowadays if I look at modern syntax.

          >hurr durr we got std::expected we just as good as Rust now
          std::expected<std::array<int, 1000>, int> foo() {
          std::array<int, 1000> result = {};
          if (rand() % 2 == 0)
          return std::unexpected(-1);
          return result;
          }

          >causes an extra copy of result
          >how you're supposed to do it to avoid the extra copy:
          std::expected<std::array<int, 1000>, int> baz() {
          std::expected<std::array<int, 1000>, int> result;
          if (rand() % 2 == 0)
          result = std::unexpected(-1); // note the assignment operator
          return result;
          }

          I swear I'm fricking done with this language, they frick up everything.

          Like, why the frick is all that bloat needed?

          I just use C++ as a superset of C with classes, lambdas and templates, that's it.
          I do enjoy the cleaner new delete keywords for memory allocation though.

          • 2 weeks ago
            Anonymous

            >just use C++ with the things I like but not the things I don't understand
            Ok.
            Personally I find that monadic return types are great. I was introduced to them when working with Apache Arrow and it just made the development process very smooth.
            I work with external hardware so almost every function can fail.
            The other alternatives are:
            The C way, in this context every single function returns an error code, which you wrap in a bunch of early return macros, making it less obvious what can return. It also means every single output has to be passed by output parameters, so the whole source code ends up as a hot soup of mutable states.
            The classic C++ way, a.k.a. exceptions with try catch blocks somewhere. It sucks for a number of reasons everyone knows by now, not least of which is the high performance impact.
            Result/expected types are just cool. It's very obvious what can fail and you can't just forget to use the error code.

          • 2 weeks ago
            Anonymous

            >monadic return types
            Any good reading material you can share?

          • 2 weeks ago
            Anonymous

            Not really. Look up how it's implemented elsewhere:
            Result type in Rust
            Result type in Apache Arrow
            Maybe monad in Haskell

          • 2 weeks ago
            Anonymous

            Small correction, they're called Either and Maybe in Haskell.

          • 2 weeks ago
            Anonymous

            isn't this just what Java had with Optionals since forever basically

          • 2 weeks ago
            Anonymous

            >modern syntax
            Oh, I don't mind C++ syntax that much. I find that syntax complaints are usually subjective and made by beginners. What I do mind is the experience of using C++: every time you want to do something, there are 20 different ways to do it, of which 15 are either deprecated or, even worse, not deprecated but containing some hidden footguns that will only become visible down the line. C++ is just a language of workarounds piled on top of workarounds to work around other workarounds, and it's only going to get worse with every release because the demand for backwards compatibility is so strong that it's the de facto #1 priority of C++. Even things that were obvious mistakes can never get fixed.
            Of course, I could pick some small subset of C++ and only use that, but I would still have to fill my head with language lawyer knowledge in order to be able to understand the source of other people's libraries. The alternative is to work on a monkey-see-monkey-do basis and I don't want that. In fact, I find it strange how there seems to be an attitude among many C++ programmers that it's normal when library source code is incomprehensible for the average programmer and only some elite caste of C++ monks can understand it. It's like some kind of programming language Stockholm syndrome. If this happened in Python or Java, people would just tell the library author to rewrite their shit code.

          • 2 weeks ago
            Anonymous

            It's accumulated technical debt from giving in instead of putting the foot down :^)

          • 2 weeks ago
            Anonymous

            >because the demand for backwards compatibility is so strong
            windows won the os war because of backwards compatibility
            c++ won the language war because of backwards compatibility
            you cant expect them to give up their winning ticket for no reason

          • 2 weeks ago
            Anonymous

            >c++ won the language war because of backwards compatibility
            Lol... lmao even... IQfy is so fricking out of touch with reality and the state of most big tech companies.

          • 2 weeks ago
            Anonymous

            but he's right. every critical system is written in C or C++. And the ones below that are stuff like FORTRAN and COBOL, that still just werks.

          • 2 weeks ago
            Anonymous

            >FORTRAN and COBOL
            These might go extinct at some point, the former more likely, but I don't code either of those, so I don't want to judge, just express an opinion.

            COBOL has international banking as a backbone, FORTRAN as I've read about it seems to focus more on the math-y and science-y aspects of coding, and those are technical aspects much more easily replaced by C in the long run than socioeconomic aspects such as directly being backed by a virtually unlimited currency management system.

          • 2 weeks ago
            Anonymous

            FORTRAN is still the main "high-performance" language in a lot of academia, particularly in engineering and physics, while most non-critical code is written in python and some other scripting languages.
            In my experience of banks and universities, the former are far more likely to eventually replace existing COBOL code than the latter are to ever adopt a different language - I don't expect FORTRAN to disappear any sooner than the universities themselves.

          • 2 weeks ago
            Anonymous

            I used Fortran in gradschool for geophysics. It's still used for sure, but most stuff is moving on to C++ lately.

          • 2 weeks ago
            Anonymous

            That's a good thing for the environment. Fortran might have been the academic darling of its day but for real performance you need to go low level. C++ has already taken over Ada's role in airplane firmware, it's high time it killed off all the other old languSegmentation fault (core dumped)

          • 2 weeks ago
            Anonymous

            No wonder we've seen so many airplane issues lately.
            C++ will end up being the language that kills the most people of all time, but no one will understand why or be able to issue any blame.

          • 2 weeks ago
            Anonymous

            The burden is on the user to do their own C++ programming. You wouldn't live in a house someone else built, why would you use code someone else wrote?

  23. 2 weeks ago
    Anonymous

    That is a trash tier video, just look at that sorry attempt of manlet.

  24. 2 weeks ago
    Anonymous

    Black personlicious

  25. 2 weeks ago
    Anonymous

    Outjerked by the literal language standard.

  26. 2 weeks ago
    Anonymous

    Ah yes, The Zen of C++: there should be 50, and preferably only 50, non-obvious ways to do it.

  27. 2 weeks ago
    Anonymous

    hang on please take my post seriously guys

    there's no fricking way that's the real infographic from the talk right?

    no one fricking thinks that is making anything clearer? if it is from the real talk surely its like a "see how problematic this is?" and then they offer a solution thats much cleaner

    i dont

    i cant handle it if that graph is the solution to anything and people think its good

    i
    help

    • 2 weeks ago
      Anonymous

      It's not only real, it's actually pretty decent advice if you're going to write in the "modern C++" style instead of C with namespaces.

  28. 2 weeks ago
    Anonymous

    Speaking as someone who only knows a little C++, in what cases do you actually need all this estoric crap? I use it like basic C but with classes for strings/arrays/etc and never had a problem. KISS.

    • 2 weeks ago
      Anonymous

      niche cases or optimizations. Im like you: I dont try to push the language. All this metaprogramming bs is overrated and I think some people are too autistic to know when things should stay simple. When you have "expert programmers" fricking up things like readability, are you really surprised languages like Python and Java exist?

  29. 2 weeks ago
    Anonymous
  30. 2 weeks ago
    Anonymous

    C++ people are all about "zero cost abstractions" until it would break some shitty code from 1999.

  31. 2 weeks ago
    Anonymous

    C++ is extremely simple and ergonomic for the right programmer. Marking this down as "skill issue".

  32. 2 weeks ago
    Anonymous

    this isn't correct advice, it's much more simple than that. anyone suggesting you should use rvalue references outside of move construct/move assign, which you also rarely write anyway, does not know c++

  33. 2 weeks ago
    Anonymous

    I had a friend in uni whose name was also Jan Bielak lol

  34. 2 weeks ago
    Anonymous

    Is that a (ugly) female with her hair pulled up, or a male child with long hair?

    • 2 weeks ago
      Anonymous

      pls don't bully the cute polish shota

  35. 2 weeks ago
    Anonymous

    jej
    https://mastodon.gamedev.place/@zeux/110789455714734255

    • 2 weeks ago
      Anonymous

      >mastodon
      the screeching of such troony libtards will be discarded

    • 2 weeks ago
      Anonymous

      modules

      • 2 weeks ago
        Anonymous

        don't fix anything

  36. 2 weeks ago
    Anonymous

    Currently trying to learn c++ and I feel like I'm barely scratching the surface with something that I'll never be able to master. It's overwhelming sometimes but I haven't given up yet.

  37. 2 weeks ago
    Anonymous

    Just learn D, it gives you 90% of the power for 10% of the complexity

  38. 2 weeks ago
    Anonymous

    They should remove the C from C++, they have nothing in common now.

    • 2 weeks ago
      Anonymous

      >yeah I code in ++

    • 2 weeks ago
      Anonymous

      >they have nothing in common now.
      all you need is extern "C"

    • 2 weeks ago
      Anonymous

      C23 adopts tons of things from C++.
      Modern C is C++'s slightly moronic cousin – it learns all the same tricks, but years later.

      • 2 weeks ago
        Anonymous

        https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3065.pdf
        They still have more differences outside of just features supported.
        Note that most of it is "weird shit that C accepts but really neither should".

      • 2 weeks ago
        Anonymous

        >[[deprecated]]
        Cool.
        >>[[nodiscard]]
        ?
        >>auto
        Frick no!

        Nice!
        (var) newVarOfSameType
        See the point, not sure if good outweighs bad.
        >>1'000'000
        Sugar.... oh honey, honey.

        Okay.
        _assert
        Never use asserts, no opinion.

        Could be less. Binary 0b111 numeric is the best, [[deprecated]] is pretty cool for developing libraries, the rest seems superfluous, at best QoL improvements, at worst it ends up like Sepples with time...

        • 2 weeks ago
          Anonymous

          >at worst it ends up like Sepples with time
          homie, every good thing you mentioned is literally (in the literal sense) copied from C++.

      • 2 weeks ago
        Anonymous

        #[embed]

  39. 2 weeks ago
    Anonymous

    If C++ is so great why haven't they made a C++++?

    • 2 weeks ago
      Anonymous

      Who said they didn't?

  40. 2 weeks ago
    Anonymous

    >can't split a string

  41. 2 weeks ago
    Anonymous

    they should make C++ without the bloat and just call it "C"

  42. 2 weeks ago
    Anonymous

    Imagine looking at that abomination of a flowchart and then calling Rust bloat

    • 2 weeks ago
      Anonymous

      It is objectively, inarguably bloated (compared to Forth)

  43. 2 weeks ago
    Anonymous

    All this bullshit, and yet it can't split a string.

  44. 2 weeks ago
    Anonymous

    >JavaScript: A language for chads
    here, I fixed that for you

  45. 2 weeks ago
    Anonymous

    Sepples is, in many ways, more "low level" than even assembly according to Alan Perlis' definition. In assembly, you don't have to deal with any of this bullshit: everything is just bytes in memory and you either copy something or pass an address. In C++... you get this.

  46. 2 weeks ago
    Anonymous

    I don't know what all that is
    I just for loop and if statement it up until everything works
    I love c++

  47. 2 weeks ago
    Anonymous

    Since /chad/ is gone I'll ask my moronic question here.
    Doing some basic shit from a book on pointers/memory management. Made a simple linked list thing, worked great, then made another header for a queue that just reuses the linked list and is basically type def'd but getting linking errors about an undefined reference to one of the queue functions. It's literally just
    typedef LinkedList Queue;
    void initializeQueue(Queue *queue) {
    initializeList(queue);
    }
    If I copy and paste that in my main file it works fine, but not with a separate header and implementation. The linked list shit works fine though as expected.
    wtf why

    • 2 weeks ago
      Anonymous

      Never mind it was a fricking typo that somehow emacs didn't even notice. Normally it catches that bullshit wtf emacs. Stupid pile of crap editor.

Your email address will not be published. Required fields are marked *