Python is memory safe? Can’t you access/address memory with C bindings?

  • signor@lemmy.world
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    9 months ago

    So how fucked am I for starting to learn cpp as my first language, or is this a later down the road thing to worry about?

    • thomask@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      9
      ·
      9 months ago

      If you can write correct C++ you’ll be able to write Rust code that compiles first time. Don’t stress, you’re learning the good stuff.

    • lysdexic@programming.dev
      link
      fedilink
      English
      arrow-up
      9
      arrow-down
      1
      ·
      9 months ago

      So how fucked am I for starting to learn cpp as my first language, or is this a later down the road thing to worry about?

      I don’t see why you should be concerned, except that no professional software developer is limited to use one specific programming language.

      Even if you pay attention to the disaster prophets in the crowd, which are mainly comprised of fanboys implicitly and explicitly promoting their pet language/frameworks, C++ dominates all aspects of the computing ecosystem, which means that in the very least the whole world needs to maintain existing C++ projects to continue to work. See COBOL for reference.

    • seth@lemmy.worldOP
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      9 months ago

      I think it’s a good first language to learn. Because it’s a lower level language than most of the popular ones these days, you will learn a lot of interesting concepts and problems you wouldn’t otherwise get or even need for higher level stuff - like memory management, allocation, garbage collection and cleanup, and pointer references - but which give you a better understanding and appreciation for what’s in the black box.

      But you also learn a lot of transferable concepts like typing, mutability, objects and object oriented design, polymorphism, etc. And there are still a ton of jobs where C++ knowledge is required or at least useful.

      I have barely touched it over the years since first using it, but patterns and approaches I learned in C++ have come in handy for me a lot when troubleshooting and when reading other people’s code, and being able to recognize who is going to be a helpful person to talk to when I run into problems I can’t quickly figure out.

    • Oliver Lowe@apubtest2.srcbeat.com
      link
      fedilink
      arrow-up
      5
      ·
      9 months ago

      Ah that’s an easy one - what would you like to do?

      My first uh… “language” was bourne shell. Not because I thought it was a cool language, but because that’s what let me do things I wanted to do at the time: automate heaps of Linux, BSD stuff.

      There are heaps of libraries and applications where C++ is the choice e.g. video games. My friend is great at Javascript because he loves web browser tech.

      Don’t stress - have fun! :)

    • zygo_histo_morpheus@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      9 months ago

      There will be plenty of jobs in c++ in the foreseeable future, so it’s not a bad language to know from that perspective. I don’t know if it’s the most pedagogical language to learn otoh, python is a better language for getting comfortable with the basics, c is better when it comes to learning a (slightly wrong but close enough) mental model of how a computer works under the hood, and there are many better languages to learn if you want to learn good approaches to thinking about problems.

      Maybe you are leaning c++ because you want to work on something specific that c++ is primarily used in, and in that case go ahead with that project. I think having something tangible that you want to work on is great when it comes to learning programing and that’s worth more than picking the “best” language. Besides, you can always learn different languages later in your career if you want/have to.

    • cum@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      9 months ago

      It’s a great language to learn. The memory safety specifically. If you only use memory safe languages, you won’t know anything about how the memory is handled in the background. Start breaking and abusing memory, it’s the best way to learn why memory safety is important, what it’s doing different, and how it’s prevented.

      Getting deep in the trenches with memory allocation is the best way to learn, since all memory safe languages do this as well, they just hide it. It’s extremely useful to know what’s going on behind the scenes and is fundamental knowledge that applies to all programming languages, past and present, no matter how much they hide it.