5 ms·
Can you ever really master C++? I've been at it more than 20 years and I'm still delighted to learn new things about the language and the library.
by criddell 10y ago
Can you ever really master C++? I've been at it more than 20 years and I'm still delighted to learn new things about the language and the library.
- bluetomcat 10y agoAnd that's the real problem with C++. You can spend 20 years solving real problems with it and still feel like a noob when you take a look at "idiomatic" template code from the standard headers. On the other hand, people like Scott Meyers have spent their lifetime and careers explaining its intricacies, without solving any real problems.
- alextooter 10y agoYep,the language it self became a problem.The designer and experts should(Which I hope) make the language easy to use without any mental burden.
- andrepd 10y agoMake the language easy to use without any mental burden? But you do realize programming is not easy, especially when you're aiming for high performance. How can you make a language easy to use "without any mental burden"? Programming is hard, programming well and with performance in mind is even more so. Some things you just can't magically make easy.
- bluetomcat 10y agoYou can program with "performance in mind" in C and the big difference will be that the problem itself will be the obstruction, not the language. In C++, you fight with the language first and then face the problem.
- criddell 10y agoWhat fight are you having with C++?
- bstamour 10y agoI actually feel the exact opposite when I program in C. C is so bare that most of my time is spent building the correct constructs I need to solve my problem. C++ on the other hand has a decent set of high level features that makes it easier for me to focus on the problem.
- adrianN 10y agoYou can write a C++ program to solve a problem that looks almost exactly like the C program you would write. But C++ brings a couple of nice features, like resource management with constructors/destructors and type-safe data structures that you just can't have in C.
- andrepd 10y agoHow can that be true, if C++ is (almost) a superset of C? Surely you can do anything in C++ identically to C, in the worst case scenario.
- criddell 10y agoProblem? On the contrary, it's one of the wonderful things about the language and community. It's alive and evolving. And what's with the Scott Meyers ding? I think of him mostly as an educator and in that respect he's very accomplished.
- bluetomcat 10y agoI think it boils down to a wider philosophical question that deserves some discussion in software development circles. The question basically is "Should we get obsessed with our constantly evolving tools at the cost of devoting significantly less time to understanding the intrinsic problems we are trying to solve?". Each time I hear a discussion between programmers, it is always these arguments of whether build tool A is better than build tool B, or whether VCS A suits their workflow better than VCS B, or how cool is the latest language feature. I never see programmers discussing the merits of their solutions, regardless of the language or environment.
- criddell 10y agoWe talk about tools all the time because it's fun and it's something we all have in common. Every once in a while something like clang comes along and it can change everything. What we don't have in common are the exact problems we are trying to solve. That's where design patterns and other higher level concepts become useful. Because the problems and solutions are so context specific, they happen on mailing lists. Tool discussions, on the other hand, are more generic and I think that's why you see them in more places.
- pjmlp 10y agoUnless we are speaking of Go, all programming languages are like that. Sometimes people think they know their favorite language, but most would fail a language puzzle quiz.
- bluetomcat 10y ago> Sometimes people think they know their favorite language, but most would fail a language puzzle quiz. But that is especially true for C++. People who are confident in knowing it often lack the fundamental C knowledge (i.e. pointer arithmetic, the complete C type system, the subtle conversion and promotion rules, etc.), but would insist on knowing C++ very well just because they know how to define classes, virtual functions and throw a shared_ptr or a vector or a map at every problem.
- pjmlp 10y agoAnd most people that say that they know C and how simple the language is, cannot differentiate between their compiler extensions and what is written in ANSI C. Nor can they correctly point out all the cases of expected semantics, UB and implementation specific behaviour. Regarding the fundamental C knowledge, part of it just leads to bad C++ code.
- mi100hael 10y ago> Unless we are speaking of Go, all programming languages are like that. Right, I'm sure Go is the one and only language out there without a single pitfall or quirk.
- twoodfin 10y agoYou can spend 20 years solving real problems with it and still feel like a noob when you take a look at "idiomatic" template code from the standard headers. It can be misleading to think of standard header code (especially template code) as "idiomatic C++". It'd be better described as "idiomatic standard-library-implementor C++", since the folks implementing stuff in std are operating under a whole set of constraints that don't affect ordinary C++ programmers. Arbitrary user-defined symbols that could be in scope, user-provided types that could have overloaded operator-comma, etc.
- aseipp 10y agoYes, and I think this same principle is roughly true for a lot of programming language implementations. It's one of the reasons it pays off to know some details about your implementation -- People should always keep this in mind. Designers and implementors are traditionally under a very different set of constraints than "average users" (who in this case are programmers), though their goals do align. But this leads to very different set of assumptions, optimizations, and tools being available. Things that would generally be overkill are suddenly very viable and worthwhile goals to achieve (e.g. micro-optimizations add up repeatedly so they're very worth it, vendoring is much more useful to control dependencies/scope of bugs), and vice versa. So I wouldn't be extremely miffed if you look at libstdc++ or libcxx or <whatever> and find it somewhat unkempt or gross compared to average code. It's often very much not-average. In fact it's likely given careful understanding of the constraints that code exists under -- you'd come up with similar results.
- erikbye 10y agoWhat do you use it for? It's such a complex language brimming with idiosyncrasies that I'd be inclined to really test anyone claiming to be a master. The standard is one thing, then there's the compiler you're using...
- deong 10y agoI claim on my CV to be an "expert" C++ programmer, but I'm quick to point out the curve that I imagine being graded on. At least in my head, there's an implied context around someone's C++ proficiency. An expert Java programmer should be able to answer most questions about Java. An expert C++ programmer should simply get to the "I have no idea" answers when the questions get interesting.
- pjmlp 10y agoI do Java, .NET and C++ consultancy and I bet an Java expert would fail most Java Puzzle questions. Also a programming language is not used alone and C++ standard library is quite tiny when compared to Java's standard library.
- deong 10y agoThat's true, but there's virtually no aspect of the C++ language or library that doesn't have a wealth of "gotcha" questions one could ask. Even parts of C++ that are "normal user" features can be remarkably tricky. I know tons of C++ programmers who I'd happily trust to write code for me who would fall flat on their faces if asked to explain some detail of what std::forward does with an rvalue reference parameter bound to an lvalue argument. There's a reason why a very common recommendation is to pick a subset of C++ and stick to it, and I've never heard of such a recommendation for any other language (outside of perhaps for portability reasons).
- criddell 10y ago> explain some detail of what std::forward does with an rvalue reference parameter bound to an lvalue argument std::move?
- BeetleB 10y agoFor me, that's the standard argument about C++ having unnecessary complexity. You don't keep learn new stuff because C++ is super, uber, powerful. It is because it is not designed well and there are far too many dark corners.
- criddell 10y agoAs I answered in another comment, I keep learning new stuff because the language is alive and evolving. IMHO it's getting safer and easier to use and understand.
- WildUtah 10y agoI've been at it more than 20 years and I'm still delighted to learn new things about the language and the library. And it's under active revision and improvement. There are great new things to learn every few years.
- digler999 10y agoI feel like I'm slowly marching toward a mirage. In a way, I dread the c++14/17 changes because it means that much more that I'm going to have to learn. Even if they stopped revising the language today, I'm probably going to learn my last C++ factoid on my deathbed.
- btschaegg 10y agoFor me personally, that would be a positive statement. I don't think any good programming language can stay good unless it keeps evolving (and yes, to me, C++ counts as one despite the occasional gotcha it comes with). That is - any language except for Lisp :-) And to be frank: I'd say that anyone opposed to continue to learn new things is entirely in the wrong field if he/she works on any technology-related job.
- digler999 10y agoI mostly agree with you. However, there's something to be said for being conservative and not always tweaking things. C++11 is amazing. I'm still working to solidify my knowledge in it and haven't even peeked into c++14 or higher yet. However, constantly learning and updating things has its drawbacks. One of the rare times I tried to be hip and use the latest stuff, I tried rewriting parts of a small Android app of mine using java 8 and lambda closures. I made it work, but it required upgrading my minimum build version (locking out older devices), the compiler could barely handle it (gave some strange indecipherable errors relating to lambdas), and ultimately it was just a step backward. That kind of thing really frustrates me, because it's wasted (at best, deferred) effort.
- dragonwriter 10y ago