3 ms·
It's not low-level, it's a perfectly modern high-level language. But as with anything C++, you and your team need to decide on a per-project basis on how far d
by stefan_ 8y ago
It's not low-level, it's a perfectly modern high-level language.
But as with anything C++, you and your team need to decide on a per-project basis on how far down the rabbit hole you are willing to go. There is a world of difference between C with classes and metaprogramming parser generators. And to the standards credit, a lot of the new stuff can be used individually.
- 0db532a0 8y agoWhat’s the best source for getting into C++ these days? I ask this as someone who already knows a good bit of C. I’m finding it difficult to know where to start, especially after reading about the proposed changes in C++20.
- htfy96 8y agoA tour of C++ from Bjarne: https://learning.oreilly.com/library/view/a-tour-of/9780133549041/ https://learning.oreilly.com/library/view/a-tour-of/97801335...
- runevault 8y agoI think that's the first edition, FYI second edition exists (dunno if it is in Safari or not).
- colanderman 8y agoStart with C++11. Learn how the STL works, and how to replace common C idioms with it. Learn how to write code that never directly calls `new` or `delete`. Learn move semantics, RAII, and the rule of 3/5 well. Dip your toes into templates. C++14 and 17 mostly just add some library features and clean up rough edges. You'll know you know C++11 well when you start wanting those features. Only then look at C++20. Bonus: there might actually be compiler support for it by then. (Caveat: You might want to learn modules sooner; they will probably be the most visible day-to-day change.)
- colmvp 8y agoPersonally, I love C++ Templates: The Complete Guide (2nd Edition) since it's such a thorough book on templates (which are pretty fundamental) and also goes into depth into other general C++ topics. It also discusses Concepts which are to included in C++20.
- 0db532a0 8y agoWhy did people downvote this?
- bra-ket 8y agoC++ primer from Lippman is the sanest https://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/0321714113 https://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/03217...
- 0db532a0 8y agoThanks to all for the sources.
- zanny 8y ago> perfectly modern Its getting modern, but its no where near perfectly. There are three different ways to allocate heap data and at least one dates back to the 70s. There are at least five ways to initialize a variable last I checked. The language is ludicrously complex to parse for both a human and a computer because its been iterated on for so long. Because the design space C++ occupies is so complex and lacking almost any feature of it kills competition Rust is about the only real competitor in the space of "modern language that does absolutely everything" besides peers like OCaml that often have too arcane a syntax for the C family linguists to get in to. But compared to C++, Rust is way more cohesive just because it started one decade ago rather than four and has much less baggage so far. And with its editions system will likely never have permanent unmitigated baggage to its benefit.
- shaklee3 8y agoYou cannot count malloc as a way to allocate heap memory as a downside. It's for legacy reasons, and can't change due to the c interoperability. In the recent Go best practices story, the author said there are at least 6 ways to declare a variable in Go. That's a language with no backwards compatible of any other language.
- zanny 8y agoYes you absolutely can, because the second you are writing C++ code with anyone but yourself you will eventually find, and have to rewrite, something someone wrote using malloc in C++. I've found code where developers casted perfectly useful data structures to void* for no reason to then index into it by memory offset to access its fields, I've seen well architected concurrent classes destroyed by consumers "friending" it and then directly addressing internal private data meant to be guarded via accessor functions, and more. C++ gives you infinite ways to shoot yourself in the foot, and even if you are the savant genius god programmer who manages to navigate its neck deep swamp of complexity your coworkers or even worse random strangers you collaborate with on the Internet absolutely won't.