• wise_pancake@lemmy.ca
    link
    fedilink
    arrow-up
    72
    arrow-down
    1
    ·
    8 months ago

    Some people hate that C is dangerous, but personally I like its can-do attitude.

    “Hey C, can I write over the main function at runtime?”

    Sure, if you want to, just disable memory protection and memcpy whatever you want there! I trust you.

    It’s a great attitude for a computer to have.

    • mindbleach@sh.itjust.works
      link
      fedilink
      arrow-up
      67
      ·
      8 months ago

      C is dangerous like your uncle who drinks and smokes. Y’wanna make a weedwhacker-powered skateboard? Bitchin’! Nail that fucker on there good, she’ll be right. Get a bunch of C folks together and they’ll avoid all the stupid easy ways to kill somebody, in service to building something properly dangerous. They’ll raise the stakes from “accident” to “disaster.” Whether or not it works, it’s gonna blow people away.

      C++ is dangerous like a quiet librarian who knows exactly which forbidden tomes you’re looking for. He and his… associates… will gladly share all the dark magic you know how to ask about. They’ll assure you, oh no no no, the power cosmic would never pull someone inside-out, without sufficient warning. They don’t question why a loving god would allow the powers you crave. They will show you which runes to carve, and then, they will hand you the knife.

      • AVincentInSpace@pawb.social
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        8 months ago

        Rust is like a paranoid overprotective guardian. A “mom friend”, of sorts. Always the designated driver of the group, keeps you from staying up too late, stops you from eating things that might be choking hazards without proper precaution, and so on and so forth. You’ll never meet a person more concerned with your health and safety – until, that is, you say the magic word “unsafe”. Suddenly the alter ego that their hypnotist implanted gets activated, and their entire demeanor changes on a dime. BMX biking? Bungee jumping? Inline assembly? Sounds like a great idea! Let’s go, man! Rules are for NERDS! Then the minute the unsafe block ends, they’re back to normal, fully cognizant of the adventure they just went on and thinking absolutely nothing of it. “Whitewater rafting with you guys was really fun, especially the part where Jason jumped into the water and I went after him! I’d best go get the first aid kit, though – that scrape he got when he did that looks like it might get infected. I know he said it didn’t hurt, but better safe than sorry!”

        They kinda scare you when they’re like that, if you’re honest.

        • mindbleach@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          8 months ago

          I tried thinking of one for Rust, and ‘the mom friend with a safeword’ is alarmingly accurate.

          The secret basement is never locked. It’s fine to go down there, alone. You’ll only be scarred on the inside.

          It’s when you go down together that all bets are off.

    • SubArcticTundra@lemmy.ml
      link
      fedilink
      arrow-up
      27
      ·
      8 months ago

      Agreed. It’s a very adult approach. C hands you a running chainsaw and whatever happens after that is your responsibility. It is also your responsibility to decide when it’s not the right time to use C.

    • mox@lemmy.sdf.org
      link
      fedilink
      arrow-up
      17
      ·
      8 months ago

      This is sometimes practical, too. For example, hooking and extending functions in compiled code that will never be updated by the original author, while preserving the original executable/library files.

    • derpgon@programming.dev
      link
      fedilink
      arrow-up
      11
      ·
      8 months ago

      I loved C/C++ in university, finally the damn piece of rock we forced into thinking was doing exactly what I told him to do, no more and no less.