Earlier quoted context omitted.
0x11 == 17
That's not a code name I've ever heard of: https://en.wikipedia.org/wiki/C%2B%2B17 C+0x was what turned into C++11. The 0x part was just a placeholder for 08 or 09, but it actually ended up taking a few years longer to ratify. Maybe people confuse C++11 with C++0x to get C++0x11.
Ask HN: What is the state of C++ vs. Rust?
101–110 of 156 posts
Re: Ask HN: What is the state of C++ vs. Rust?
#102C is still significantly faster than Rust which follows that C++ is too. So unless Rust is able to produce binaries on all major platforms that are as fast as C++, people who need to squeeze out as much performance as possible are not going to drop the language.
Rust will be if is not already faster than C. Especially in real-life projects. One example would be https://github.com/BurntSushi/ripgrep Aliasing rules in C make some optimizations not possible in C. Good luck putting that `restrict` everywhere to compensate. Generics with static dispatch makes it possible to get a code that is way better than what a sane person can write with C's preprocessor. Practical developer…
Re: Ask HN: What is the state of C++ vs. Rust?
#103Earlier quoted context omitted.
Ah, I see. The main difference I can see is that it's opinionated, because everything else can be done by pip too (you can install utilities right in your path with it). I agree that being opinionated is a big help. Everyone in Python-land uses virtualenv and pip, but it would be great if (as is actually happening now), they were bundled with the language and were the One Blessed way of creating a new project: virtua…
So you want to say that some arcane chain of commands that I have to remember is as good as `cargo run` to run `cargo install name` to install? `pip` and Python are riddled with problems. Native modules fail to compile all the time and since Python is so slow, it requires a lot of native code. python2 vs python3 share `PYTHONPATH` and `virtualenv` is inheriting it: http://stackoverflow.com/questions/24583777/why-does…
> Third, how (as a user) am I supposed to reliably install and start a Python software system-wide? With a whole `virtualenv`, or with a script that activates it every time? And what if you want to use one python program to run another python program and one is using python2 and other python3 etc? :D
You don't need to activate a virtualenv to run an application from it. Eg. some_virtualenv/bin/some_binary just works, regardless of other active virtualenvs or what Python/Java/C program invokes that.
And maybe this bit here:
> So you want to say that some arcane chain of commands that I have to remember is as good as `cargo run` to run `cargo install name` to install?
The commands he mentioned would be used to create a new project, not to install anything.
Re: Ask HN: What is the state of C++ vs. Rust?
#104Earlier quoted context omitted.
I've only used Rust lightly, but can someone explain what Cargo does differently from pip-tools? As far as I can tell, you have two files in both systems: One with the dependencies you'd ideally like to use, and one with the ones you actually used (and tested with). That way, you can update when convenient, but people who get your software have an exact known good environment. What makes Cargo that much better than p…
One thing that's nicer is that because Rust is a compiled language, Cargo produces a (statically-linked ) binary. Python and your Python environment always needs to be set up on the machine that you're going to run it on. statically-linked by default except for on Linux where it links to glibc dynamically by default IIRC, but going fully static there is easy, and going fully dynamic is easy too.
Static binaries (with system libc) on Linux are okayish, if all the systems are the same distro, or at least have a libc of the same vintage, but breaks frequently if you try to go further (eg. deploying to LTS distros like deb oldstable, centos, ...).
Doesn't really compare to eg. Windows, where you just bundle the MSVCRT with the installer and unless you're API incompatible the application will just work everywhere.
Re: Ask HN: What is the state of C++ vs. Rust?
#105Earlier quoted context omitted.
But one doesn't pick what to learn just between several languages, in fact I think they're a pretty poor investment after a certain count. When learning Obj-C I didn't get much out of it. I like several Swift idioms, but it was hardly worth it to learn a language for that. In contrast I finished an architecture course recently that I expect will bring me 10x value of knowing both of the above languages. Please see my…
What's the architecture course? I've been meaning to move from learning languages and APIs to learning more "lasting" things.
Reading the book should be a very useful first step when learning about architecture.
If one decides to go to the course it's essential that there are also experienced architects participating and that one has an architectural case study that can be discussed.
Re: Ask HN: What is the state of C++ vs. Rust?
#106Earlier quoted context omitted.
I tend to think carefully about lifetimes, resource ownership and writing secure code. I am careful with threading, use language idioms to enforce safety and also use tools (such as valgrind, but also static analysis) to check the code. This is not as reliable as Rust's compile-time safety checks, but in practice it works well enough for me. I don't think this is typical for all C++ projects or programmers e.g. I am…
Out of curiosity, do you have (open-source) examples of C++ projects that do it right? In my numerous-though-irregular years as a C++ programmers, I haven't seen any project producing code that's convincingly safe. I won't list all the pitfalls of C++ here, but, well, who doesn't have war stories of bugs-because-of-aliasing, bugs-because-of-const-doesn't-actually-mean-constant, bugs-because-pointer-is-still-being-use…
Re: Ask HN: What is the state of C++ vs. Rust?
#107Earlier quoted context omitted.
Rust will be if is not already faster than C. Especially in real-life projects. One example would be https://github.com/BurntSushi/ripgrep Aliasing rules in C make some optimizations not possible in C. Good luck putting that `restrict` everywhere to compensate. Generics with static dispatch makes it possible to get a code that is way better than what a sane person can write with C's preprocessor. Practical developer…
It is not already faster and there are benchmarks that proves that. Check out of the The Computer Language Benchmarks Game, for example. Lots of language communities make the claim that "their" language either is or will eventually be faster than C. Haskell, Julia, Go, Java, Swift... But the proof of the pudding is in the eating and so far none of these safer languages has beaten C.
Re: Ask HN: What is the state of C++ vs. Rust?
#108Earlier quoted context omitted.
> I would lose a lot of experience, libraries, a mature stable platform and job opportunities in exchange for more memory safety - something that's not a particularly pressing issue for me. May i ask why memory issues are not a pressing issue for you? having to hunt down memory corruptions / access to dangling pointer / memory leaks is a pretty frequent occupation for me (as a C/C++ developer). There are tools like v…
I tend to think carefully about lifetimes, resource ownership and writing secure code. I am careful with threading, use language idioms to enforce safety and also use tools (such as valgrind, but also static analysis) to check the code. This is not as reliable as Rust's compile-time safety checks, but in practice it works well enough for me. I don't think this is typical for all C++ projects or programmers e.g. I am…
What about a team? If you are leading a team of programmers, would you rather use Rust (where finding if the code is doing anything unsafe using a simple grep) or C++ where finding dangerous code is a lot harder?
I think the point of using langauges like Rust and Haskell only comes into play when the development is done by a team. It is one thing to hope that every one in your team is as disciplined as yourself (including yourself on a bad day), and knowing for certain that the language won't allow bad stuff to happen...
Re: Ask HN: What is the state of C++ vs. Rust?
#109Earlier quoted context omitted.
Rust will be if is not already faster than C. Especially in real-life projects. One example would be https://github.com/BurntSushi/ripgrep Aliasing rules in C make some optimizations not possible in C. Good luck putting that `restrict` everywhere to compensate. Generics with static dispatch makes it possible to get a code that is way better than what a sane person can write with C's preprocessor. Practical developer…
It is not already faster and there are benchmarks that proves that. Check out of the The Computer Language Benchmarks Game, for example. Lots of language communities make the claim that "their" language either is or will eventually be faster than C. Haskell, Julia, Go, Java, Swift... But the proof of the pudding is in the eating and so far none of these safer languages has beaten C.
(Rust is currently beating C on one benchmark, within a few tenths of a second on a few more, and then way slower on the SIMD-reliant ones)
Re: Ask HN: What is the state of C++ vs. Rust?
#110Earlier quoted context omitted.
It is not already faster and there are benchmarks that proves that. Check out of the The Computer Language Benchmarks Game, for example. Lots of language communities make the claim that "their" language either is or will eventually be faster than C. Haskell, Julia, Go, Java, Swift... But the proof of the pudding is in the eating and so far none of these safer languages has beaten C.
There's been a lot of variance on the benchmark game lately since things are so close; a couple of months ago, Rust was #2 overall, beating out C++ and just a tad slower than C. The areas where Rust lost the most were because explicit SIMD isn't stable yet. We also upgrade LLVM regularly, and that can cause some fluctuations from time to time. (Rust is currently beating C on one benchmark, within a few tenths of a se…