this post was submitted on 19 Mar 2024
145 points (92.9% liked)

Programming

17432 readers
225 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
145
submitted 8 months ago* (last edited 8 months ago) by [email protected] to c/[email protected]
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 7 points 8 months ago (6 children)

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?

[–] [email protected] 2 points 7 months ago* (last edited 7 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.

[–] [email protected] 9 points 8 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.

[–] [email protected] 3 points 8 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.

[–] [email protected] 8 points 8 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.

[–] [email protected] 5 points 8 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! :)