• Digital Mark@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 day ago

    If you write to a text (as opposed to binary) stream, \n produces \n or \r\n (or \r if old enough) depending on platform just fine.

    Nobody should be using C++ anyway, but plenty of languages have silly system newline constants, which do nothing useful.

      • easily3667@lemmus.org
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 day ago

        It’s memory unsafe and it’s syntax is indistinguishable from the runes which summon cthulu.

        • thebestaquaman@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          23 hours ago

          Memory unsafe C++ is a choice. With modern C++ you have no excuse for accessing raw pointers or arrays without range checking if memory safety is a priority.

            • thebestaquaman@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              21 hours ago

              As I said: There are tools in place in modern C++ that are designed to catch the errors you make. If you are using a raw pointer when you could have used a reference, or accessing an array without range checking, those are choices you’ve made. They may be valid choices in your use-case, but don’t go complaining that the language is “unsafe” when it gives you the option to code with guard rails and you choose to forgo them.

        • MrScottyTay@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          1 day ago

          I think the memory stuff is pretty good nowadays. I’m sure I saw modern C++ can have a garbage collector. And the syntax is only runelike until you learn it, like any language really. As an industry C# developer I’ve recently taken up C++ as a hobby to better learn the workings of low level code and I’ve been enjoying it so far.

          • easily3667@lemmus.org
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            23 hours ago

            c# has lovely syntax and languages like it and python are pretty readable with basic coding knowledge. C++ if you don’t know a symbol there’s too many options and the risk of misunderstanding is too high.

            I will agree with your claim “if you learn the syntax then you know the syntax” but I don’t find this valuable.