News for hackers. Stuff that matters.
Re:Ask HN: Best way to learn modern C++? by cpburns2009 on Wednesday March 07, 2018 @09:09AM (#16536395)
I'm not the OP, but I'm tempted to learn more C++ so that I can directly use Qt without relying on language bindings for it. I like the idea of Rust, and maybe some day I'll tinker with it, but it looks like it has quite the steep learning curve.
Re:Ask HN: Best way to learn modern C++? by steveklabnik on Wednesday March 07, 2018 @09:31AM (#16536574)
First of all, I should say that I feel like bringing up Rust in this thread is inappropriate, and I’m glad the OP was downvoted.

To comment briefly on the learning curve, the trade off is basically, C++ is easier to get started, but harder on the high end. Rust is a bit harder for C people to get started, but then the high end is much easier. Rust’s curve is flatter, in a sense.

Oh and also: learning one will certainly help you learn the other in many cases. I advocate learning many languages :)

This week I’m visiting a ~700 person company in London that’s moving away from C and towards Rust. They’re not doing a Big Rewrite, obviously, so they still have quite a bit of C too. They chose Rust over C++ though. It always depends!

Re:Ask HN: Best way to learn modern C++? by carlmr on Wednesday March 07, 2018 @09:54AM (#16536747)
>Oh and also: learning one will certainly help you learn the other in many cases. I advocate learning many languages :)

Especially the Rust borrow checker will make you mad in the first place, and then teach you something about memory management you will be able to use in C++. It really improves your mental model in places you didn't expect.

Re:Ask HN: Best way to learn modern C++? by cmollis on Wednesday March 07, 2018 @12:41PM (#16538123)
does Rust basically have the same 'move' semantics as C++ ?
Re:Ask HN: Best way to learn modern C++? by steveklabnik on Wednesday March 07, 2018 @12:51PM (#16538214)
Yes and no. The idea is the same, the implementation is very different.

Rust is “move by default, move always means memcpy (and they often can be elided), no move constructors,” to (possibly too) succinctly describe it.

Re:Ask HN: Best way to learn modern C++? by cmollis on Tuesday March 13, 2018 @07:40PM (#16580900)
cool.. I didn't realize that move meant memcpy.. does this operation destroy the original object?
Re:Ask HN: Best way to learn modern C++? by leetcrew on Wednesday March 07, 2018 @09:32PM (#16541813)
if you aren't already very familiar with c, i would say the learning curves for c++ and rust are pretty similar. it will take you longer to get stuff to compile in rust, but correcting instances of undefined behavior in c++ can also take a long time in c++.
Re:Ask HN: Best way to learn modern C++? by cpburns2009 on Wednesday March 07, 2018 @10:07PM (#16541981)
I know enough of the basics of C and C++, and their standard libraries to shoot myself in the foot with, and I'm sure invoke undefined behavior in the process (I do realize they are separate but related languages). Rust on the other hand appears to be a completely different paradigm from my primary experience which is in managed languages (e.g., Python, Java, etc.). In particular the borrow checker, while a marvelous idea, I think would pose a quite the challenge to get accustomed to.
Re:Ask HN: Best way to learn modern C++? by leetcrew on Wednesday March 07, 2018 @10:16PM (#16542027)
it's really not that bad. for a beginning programmer, the places where you would struggle with the borrow checker in rust have a lot of overlap with cases in c/c++ where you would struggle to fix all the errors reported by valgrind.