Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I didn't say it was safer

https://news.ycombinator.com/item?id=44846507

Zig is safer than C++

I copy and pasted what you said.



> I copy and pasted what you said.

No, you didn't. You wrote "You might like making and freeing every heap allocation but that doesn't mean it's safer." That is a very different claim (and one I didn't make) than "Zig is safer than C++".

Zig is safer than C++ because it makes some absolute guarantees that C++ doesn't, and C++ doesn't make any absolute guarantees that Zig doesn't. But no memory leaks is not a guarantee that either Zig or C++ make.

Zig and Rust guarantee that all Zig and Rust programs are free of out-of-bounds access (unless they explicitly use syntactically distinct "unsafe" operations). C++ makes no guarantee about all C++ programs that these two other languages don't make.

To what degree that matters is a perfectly fine subject for debate, but that particular thing - again, important or not - is how I (and others) define "safety" (as it pertains to a language), and I made it clear that that's the definition I'm using.

By that definition, memory leaks are not safe in C, C++, Zig, or Rust, but Zig is still safer than C++ because of other properties that are safe in Zig.


> I copy and pasted what you said.

No, you didn't.

I literally did. I linked your comment and copy pasted from it. What are you even talking about here? That's what you wrote, it's right there.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: