-23 points
*

C is memory safe if you program it well enough, so I guess C

permalink
report
reply
12 points

C? Memory safe? HAHAHAHA

permalink
report
parent
reply
1 point

落ち着いてください

permalink
report
parent
reply
0 points
Deleted by creator
permalink
report
parent
reply
-7 points
*

Lol. The people downvoting your comment need to get good.

permalink
report
parent
reply
4 points

Skill issue.

permalink
report
parent
reply
21 points

Every car has airbags if you drive well enough. Right?

permalink
report
parent
reply
4 points

You can still make stupid mistakes in Rust. It may make it harder to make the most common mistakes, but pretending the guardrails are prevent any type of mistake is asking for a problem to happen.

permalink
report
parent
reply
3 points

The only one pretending mistakes can’t happen is the person I replied to. Mistakes definitely can happen and no programming language is fool proof.

Continuing my car analogy, would you rather drive a car with airbags and seatbelts or one without them? Of course you can still have a fatal accident, but it’s nice to have safety features that make it as unlikely as possible.

permalink
report
parent
reply
26 points
*

every single language (except Vlang of course) is memory safe if you program it perfectly.

Very, very few humans are capable of doing that, especially with C.

permalink
report
parent
reply
5 points

C++ with -Wall -Werror, and no pointer diddling.

permalink
report
reply
17 points

Its definitely best to try and avoid raw pointers, but even if you try really hard I found it’s not really possible to get a Rust-like experience with no UB.

Even something as simple as std::optional - you can easily forget to check it has a value and then boom, UB.

The C++ committee still have the attitude that programmers are capable of avoiding UB if they simply document it, and therefore they can omit all sanity checks. std::optional could easily have thrown an exception rather than UB but they think programmers are perfect and will never make that mistake. There are similar wild decisions with more recent features like coroutines.

They somehow haven’t even learnt the very old lesson “safe by default”.

If I wanted memory unsafety I think I would consider Zig instead of C++ at this point.

permalink
report
parent
reply
2 points

I recently got bitten by exactly that std::optional UB and here I was thinking 🤔 after 12+ years in the industry starting all the way back in the day with C++03 that modern C++ was supposed to make things better.😐

permalink
report
parent
reply
3 points

C++, with some Skill

/s

but seriously, I don’t know any language with a good, C/Cpp-like Syntax (so not Rust), with a good compiler (again not Rust). So I’m sticking to Cpp.

permalink
report
reply
8 points

You should check out zig, its compiler can even be used for c/c++. If you have time to listen to an interview, this developer voices interview on zig explains some of the advantages of this: https://www.youtube.com/watch?v=5_oqWE9otaE&t=3970s

permalink
report
parent
reply
8 points

Thinking about zig for some stuff.

Mostly because those rusticles are pissing me off.

permalink
report
parent
reply
2 points

I don’t know what you are talking about?

Rust is such an amazing language, it’s so safe and clean and beautiful and simple and clear to read and such wow community that are making amazing crates for cargo because cargo is so cool I like it so much so easy to…

Oh, and your fav lang sux alot!1 lolololllll

permalink
report
parent
reply
3 points

What’s so bad about the Rust compiler? I know it’s slow, but given all the analysis it’s doing, it makes sense. And, from my own experience, setting correct optimization levels for dependencies along with a good linker makes incremental builds plenty fast.

permalink
report
parent
reply
33 points

That is a very specific subset

permalink
report
reply
30 points

Garbage collection is still allowed, and technically JIT languages are still compiled so it really isn’t that restrictive

permalink
report
parent
reply
3 points

Java, the language so good you compile it twice!

permalink
report
parent
reply
5 points

Not that specific tbh, most newer native languages these days are compiled and memory safe (Rust, Swift, Go, Kotlin Native, etc)

permalink
report
parent
reply
-8 points

Python

permalink
report
reply
10 points

They specified statically typed languages. Python would be dynamically typed

permalink
report
parent
reply
-1 points

Python is dynamically typed by default, but lots of Python is statically typed.

permalink
report
parent
reply
4 points

No python is statically typed. You have type hints, which makes the language tolerable but like their name implies it’s a hint at the type. You can perfectly legally pass in something completely different that doesn’t conform whatsoever.

The primary thing static languages provide is static typing, that being the ability to determine before runtime that all the types are valid. A good example of this is how C++ programs will refuse to compile if you try to invoke a method that doesn’t exist on the type. That’s because it’s statically typed. At compile time you know that the code is wrong. Dynamic languages fundamentally don’t work like that. You cannot know until runtime if the method you called or the field you are trying to touch exists or not. Again type hints help a lot with this but that doesn’t change how the language actually operates.

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

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



Community stats

  • 2.3K

    Monthly active users

  • 970

    Posts

  • 8.7K

    Comments