4 ms·
I would still suggest that people learn C before attempting C++; while someone with C# or Java experience could probably do well in a "modern C++" codebase, as
by pjc50 6y ago
I would still suggest that people learn C before attempting C++; while someone with C# or Java experience could probably do well in a "modern C++" codebase, as soon as they go off-piste into memory allocation and pointers they're in for surprises.
(Is there anyone who learns Rust who isn't already a proficient but frustrated C++ programmer?)
- qsort 6y agoCompletely agree, that was part of the point I was making, for example, I doubt I would ever have understood RAII had I never seen malloc. Parent was suggesting they are already a programmer, so I assumed they already had at least a grasp of how pointers and manual memory management work. If one happens to lack such knowledge, I agree learning C is an excellent first step.
- asveikau 6y agoI understood malloc very well long before RAII made sense to me. I think what made RAII seem like a good idea was seeing a large C code base at a major company which had a consistent approach to cleanup and error handling. It's very possible to write good code that way, but it takes manual effort, discipline, consistency. At that point I understood that RAII was about letting the compiler handle what I was already doing in C.
- nicoburns 6y ago> Is there anyone who learns Rust who isn't already a proficient but frustrated C++ programmer? Yes, I learnt Rust as a JavaScript/PHP/Python programmer who needed better performance for a project, and I'd thoroughly recommend it as a first low-level language. I found it much easier to learn than C++. There were a few new concepts to learn, but: - There were far fewer than C++. - The Rust Book provided a free and very approachable resource for learning them. - The Rust compiler gave me immediate feedback if I was doing something wrong (no unexpected bugs in production) - Most of my JS skills translated pretty straightforwardly - /r/rust has a very helpful community which filled in any gaps that weren't covered elsewhere. C is simple when you're working with toy examples, but as soon as you try to do anything moderately complex the complexity quickly jumps. e.g. If I wan't to use something as basic as a HashMap this is a trivial import in Rust or C++, but a non-trivial task in C. You either have to build/import a library (which is not that easy in C), or write one yourself! Same for string operations!
- ognarb 6y agoI would recommend you to watch "CppCon 2015: Kate Gregory “Stop Teaching C"" https://www.youtube.com/watch?v=YnWhqhNdYyk https://www.youtube.com/watch?v=YnWhqhNdYyk
- steveklabnik 6y ago> (Is there anyone who learns Rust who isn't already a proficient but frustrated C++ programmer?) We have a lot of people who come from ruby/python/js, and/or haskell/ocaml/scala. They find Rust an easier foray into systems languages than C++. And even some C veterans who never got on board the C++ train.
- 0x008 6y agoI learn Rust because I need a statically typed non-jvm alternative for backend and for me Go is lackluster in its expressiveness after coming from Scala.