list · 2020-10-02 21:28
What the best way to learn modern C++ ?
I know that for C it's these two:
https://modernc.gforge.inria.fr/
https://nostarch.com/Effective_C
Molly Millions · 2020-10-02 21:46
>>19079
>>38
lurk more
Stallman · 2020-10-03 12:18
The Rust Programming Language
Y.T · 2020-10-03 16:09
i use c for work and im so fuarrrking glad its not c++
yet another layer of random bullshit that has to all work just right together would be so annoying. keep these abstract const virtual templates to yourself
Cypher · 2020-10-03 17:28
>>21094
Idk if you're being facetious, but my brother actually told me this exact thing when I asked him some variation of OP's question. He said to learn the rust way of doing things then come back to C++ and try to implement those ideas (apparently C++17 has a lot of rust-like features now).
pop · 2020-10-03 17:58
>>21099
>learn the rust way of doing things then come back to C++ and try to implement those ideas
Absolutely terrible advice for beginners. You should learn in the language that gives you full freedom to experiment, discover all the pitfalls and ways you can shoot yourself in the foot, and only then put on the straitjacket and jump into the padded room language if you don't feel confident.
>C++17 has a lot of rust-like features
More like, rust has had lots of C++-like features from the very beginning.
Roy Batty · 2020-10-03 21:26
>>21099
Rust is nice, but if you want to learn C++ I'd say just learn C++. Rust and C++ have a lot of superficial similarities, but deep down they're pretty different, with Rust drawing pretty heavily from ML.
>>21100
I don't think OP's a beginner, but if he was I'd say C++ is a pretty bad choice. Footguns and pitfalls aren't going to help you learn, they're just going to distract you from the more important broad concepts of how a program generally works.
I know from experience that I couldn't really couldn't get very far in C++ until I'd learned the overall principals of programming in easier languages like Python and Scheme.
nibble · 2020-10-04 20:10
>>21099
rust helped me understand c++'s memory management better, but I'm a huge fool
FILLER · 2020-10-05 01:52
>>21100
>Absolutely terrible advice for beginners
Well I'm not a beginner so his advice was appropriate in that aspect. I just do most of my programming in C and only know the older object oriented style of C++. I was just curious about what modern industrial C++ is like, and was told that it uses a lot of the same concepts you'll pick up naturally from learning rust.
bit · 2020-10-05 17:06
>>21081
The standards are literally the best source of documentation on any language. It might be harder but you'll come out better than anyone who uses tutorials or guides which are basically washed out versions of the standard
⍕ · 2020-10-07 01:00
>What the best way to learn modern C++ ?
don't
Junichi Fujiwara · 2020-10-09 22:48
>>21097
I very agree, but some kind of generics would be nice. They don't have to be as messy as templates
vector · 2020-10-11 03:02
C++ crash course
vector · 2020-10-11 03:19
>>21139
I agree but there are some caveats. When you learn from docs it's kind of easy to screw yourself over with unknown unknowns, because you're usually just looking up the core features and then filling in with more specific things as needed. However if you get used to solving a problem one way, there may be another better way that you aren't exposed to because you don't look up documentation for things that you already know how to do. This is especially common in massive languages like C++. The best way to learn is a combination of docs and reading other people's code.
Pris · 2020-11-11 03:22
There is nothing wrong with learning C++ in 2020: it's still king for game dev, audio and visual programming, stuff with a lot of math that needs to go fast and can't afford a GC pause.
For new C++20 stuff, this video is helpful: https://www.youtube.com/watch?v=ImLFlLjSveM
It covers coroutines, concepts, ranges and modules in a pretty accessible way. Concepts and modules seem really useful to me.
For the rest, have you heard of RAII, the rule of three, virtual destructors, unique_ptr<T>/shared_ptr<T>, constexpr, and atomics?
This is the kind of stuff you need to learn if you want to indulge in modern C++, mainly. That's what I'm trying to learn personally.
I recently came across a post by the creator of Clasp on HN where he said he was glad to build his technology on C/C++ compilers and Common Lisp because they are three languages that are extremely stable, have official standards and won't go away anytime soon.
Rust seems better designed than C++, maybe it is the "much smaller and cleaner language struggling to get out [of C++]", and it's certainly worthwhile to learn it, and Python has much more readily-available libraries than Common Lisp. Still, I wouldn't be surprised if some C, C++ or Lisp code will run somewhere on this planet after any of us die.