this post was submitted on 26 Feb 2024
266 points (96.5% liked)

Programming

17326 readers
170 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 !webdev@programming.dev



founded 1 year ago
MODERATORS
 

On the one side I really like c and c++ because they’re fun and have great performance; they don’t feel like your fighting the language and let me feel sort of creative in the way I do things(compared with something like Rust or Swift).

On the other hand, when weighing one’s feelings against the common good, I guess it’s not really a contest. Plus I suspect a lot of my annoyance with languages like rust stems from not being as familiar with the paradigm. What do you all think?

you are viewing a single comment's thread
view the rest of the comments
[–] onlinepersona@programming.dev 24 points 8 months ago* (last edited 8 months ago) (2 children)

Leaders in Industry Support White House Call to Address Root Cause of Many of the Worst Cyber Attacks

And it's called C/C++. It's gotten so bad that even the friggin' white house has to make a press release about it. Think about it, the place where that majority barely even understand the difference between a file browser and a web browser is telling you to stop using C/C++. Hell, even the creator and maintainers of the language don't know how to make it memory safe. If that isn't a wake up call, then nothing ever will be.

And this isn't the first call! The IEEE also says more clearly: GTFO C/C++.

If you want memory-safe, don't write C/C++. Trying to get that shit memory-safe is a hassle and a half. You're better off learning a language that isn't full of foot-guns, gotchas, and undefined behavior.

CC BY-NC-SA 4.0

[–] Feathercrown@lemmy.world 10 points 8 months ago

You’re better off learning a language that isn’t full of foot-guns, gotchas, and undefined behavior.

As a JS developer, seeing this quote about C/C++ for a change gives me unbelievable levels of schadenfreude

[–] abhibeckert@lemmy.world 10 points 8 months ago (2 children)

~~If you want memory-safe,~~ don’t write C/C++.

Fixed that for you. There's no situation where you want buffer overruns.

[–] cm0002@lemmy.world 21 points 8 months ago

There's no situation where you want buffer overruns.

I want buffer overruns in my game consoles for jailbreaking purposes lmfaoooooo

[–] evranch@lemmy.ca 4 points 8 months ago* (last edited 8 months ago)

If you don't want ~~memory-safe~~ buffer overruns, don’t write C/~~C++~~.

Fixed further?

It's perfectly possible to write C++ code that won't fall prey to buffer overruns. C is a lot harder. However yes it's far from memory safe, you can still do stupid things with pointers and freed memory if you want to.

I'll admit as I grew up with C I still have a love for some of its oh so simple features like structs. For embedded work, give me a packed struct over complex serialization libraries any day.

I tend to write a hybrid of the two languages for my own projects, and I'll be honest I've forgotten where exactly the line lies between them.