Earlier quoted context omitted.
Agreed but doing this at compile time would require some sort of pointer lifetime tracking in the compiler. Don't know how much of this is feasable without going "full borrow checker", but static analyzers for C do a similar thing, by far not as watertight as Rust of course. The General Purpose Allocator can optionally catch use-after-free by not recycling virtual memory addresses, not very efficient for small high-f…
> ...but static analyzers for C do a similar thing.. Exactly, which begs the question why bother with Zig at all.
Ask HN: Learn C++11 or Rust in 2022?
141–150 of 161 posts
Re: Ask HN: Learn C++11 or Rust in 2022?
#142Earlier quoted context omitted.
memory safety issues are the result of poor software engineering.
History has demonstrated over and over and over again that c/c++ code above a certain complexity threshold (which is fairly low), _will_ have memory safety issues. It doesn't matter how good you are at engineering.
Re: Ask HN: Learn C++11 or Rust in 2022?
#143Re: Ask HN: Learn C++11 or Rust in 2022?
#144Earlier quoted context omitted.
at least c++ doesn't force constructs onto you. remember java? that language was a fad too that didnt' go anywhere, because it forced object-oriented programming onto the user.
I remember, it is running on all the mobile phones around the house, on the TV, on the blueray player, and apparently Amazon needs it to deliver my packages, Netflix to manage the next movie I want to watch,...
i worked for a startup once that put a java based GUI on top of some C code and used the JNI. the endless issues with java bankrupted the company as the clients who were supposed to adopt the solution refused to deal with the sub par performance and reliability.
Re: Ask HN: Learn C++11 or Rust in 2022?
#145Re: Ask HN: Learn C++11 or Rust in 2022?
#146Earlier quoted context omitted.
I remember, it is running on all the mobile phones around the house, on the TV, on the blueray player, and apparently Amazon needs it to deliver my packages, Netflix to manage the next movie I want to watch,...
ah yes, it runs on a lot of mobile phones, and app developers cannot get consistent performance out of all those different phones, thanks to java and the Shit OS that runs on them, which shall remain unnamed. i worked for a startup once that put a java based GUI on top of some C code and used the JNI. the endless issues with java bankrupted the company as the clients who were supposed to adopt the solution refused to…
Re: Ask HN: Learn C++11 or Rust in 2022?
#147Earlier quoted context omitted.
> ...but static analyzers for C do a similar thing.. Exactly, which begs the question why bother with Zig at all.
Zig is a much more ergonomic language, toolchain and build system. And since Zig is also a C/C++/ObjC toolchain, it's not about "Zig or C/C++", but about "Zig and C/C++" (at least from my PoV).
Maybe someone proves me wrong with some killer application that makes Zig unavoidable for the rest of us.
Re: Ask HN: Learn C++11 or Rust in 2022?
#148Earlier quoted context omitted.
And your software will continue to have memory safety issues.
memory safety issues are the result of poor software engineering.
Re: Ask HN: Learn C++11 or Rust in 2022?
#149Earlier quoted context omitted.
I agree, and let's not even start with operator overloading. Rust on the other hand seems to be a safe but also rather explicit language (a good thing not just for system programming).
I am talking about Rust, not C++
Re: Ask HN: Learn C++11 or Rust in 2022?
#150Here’s a fun way to decide. Do Raytracing in One Weekend[1] in one of them. Then rewrite it again in the other. That should give you a good sense for which one you want to invest in. Spoiler: I did this exercise myself. I found Rust to be more convenient in some ways. The Rayon crate made adding parallelism (threads) pretty easy. Some other crates made things pretty terminal output easier. C++ feels more familiar to…
Is it a sin to say that, because you know c++ so well you don't need the nanny's and excessive overhead of validation?
That's akin to someone saying they never need to write tests.
Have you ever started a project without tests?