4 ms·
People who learn C++ this way tend to miss stuff out, I think - there are a lot of thing that you can just muddle your way though without really understanding.
by to3m 12y ago
People who learn C++ this way tend to miss stuff out, I think - there are a lot of thing that you can just muddle your way though without really understanding.
I'm sure there are some people that think this will be OK; after all, lots of people say you don't really have to understand templates unless you're writing a library (and so on). But I don't think it will be OK. There was very little in C++98 (that I knew well, at the time) that it was OK not to know; unless you knew all of it, pretty much, you couldn't really use any of it safely. (This is how Scott Meyers makes his living.) I can't imagine C++11 will be any different; I might not know it well, but I do note that it has many of the same people behind it.
- throwawayaway 12y agoobviously we disagree! i think it's ok to miss out on language features. templates, as you say yourself you're ok not to know. you're also not ok not to know exceptions. there's other stuff too, you can get away without the C preprocessor. C++ is too big to know all of and it's a waste of time to invest time trying to, unless you are on a standards committee or are writing a compiler...(and even then you can get away with being a specialist!). it's much better to be a program writer than a language lawyer and dare I say it: more satisfying too. i draw a huge distinction between people that understand a language and people that can use a language, and i think people underestimate the time and effort in understanding a language. i think that time and effort could be better spent writing programs.
- egwor 12y agoI agree; sometimes you have to start somewhere. Then come back and improve knowledge. Trying to be a theoretical expert early on will bite you
- danieldk 12y agoThe thing is that most of the things that your parent mentions are not just some theory. Exceptions, templates, and the C preprocessor are used in most real-life C++ code. I think starting from somewhere with modern C++ means not starting at C strings, arrays, and bare pointers but starting with STL containers, STL algorithms, and smart pointers etc. to build good habits. But eventually any good introduction has to cover C arrays etc. as well. Back when I started C++, Accelerated C++ was that sort of introduction. But AFAIK it's not updated for C++ 11 or 14.
- throwawayaway 12y agoI agree that picking a subset is the way to go. Google avoid two out of the three i mentioned that you take issue with avoiding. Places I have worked the code is divided into libraries and coding standards per library are different to the whole. The point is to lazily learn the part that the codebase you are working on uses and get cracking rather than waste time getting book smart on parts you may never use.
- danieldk 12y agounless you are on a standards committee or are writing a compiler... Or you work on an existing codebase. Most C++ code that I worked on had templates, exceptions, and used the C preprocessor. I used to have your attitude. This works for many languages, e.g. if you know some of the syntax of Python or Go and the usual stuff from the standard library, you can get pretty far. If you want to write modern C++, this is not really true. You need to know about const correctness, lifetimes, some templates, etc. Or you cannot deal with most projects or libraries, like Boost, Eigen, etc. It's like saying you can program Haskell in 2014 without knowing typeclasses, lenses, GADTs, etc. You can write some educational form of Haskell, sure. But many libraries use these.
- throwawayaway 12y agoModern C++ is a moving target. By the time you get around to doing a project with one set of features they've been made redundant. Exceptions are a good example of this with noexcept etc coming in and replacing what went before. I know nothing of haskell. My point is that you should learn the features of the codebase you work on, and it's a waste of time to learn all features, ultimately for a codebase you are not working on or may never work on. incidentally, ditto, i used to have your attitude.
- lomnakkus 12y ago> obviously we disagree! i think it's ok to miss out on language features. Sure, but there are a ridiculous number of edge cases which result in undefined behavior -- this is something that cannot be avoided when learning C++. You really need to understand what undefined behavior means and what precautions you need to take to avoid it. (Don't get me wrong, recent standards let you write code that's a lot less likely to run into UB, but you need to learn that from somewhere. You should definitely not be approaching modern C++ as an improved C!)
- throwawayaway 12y agothe edge cases are multiplicative, the more features you use, the more they interact. therefore by reducing language features that you use you reduce the number of edge cases you run in to. most shops agree on a subset of C++ before embarking on a project. i didn't say to approach C++ as an improved C. you are more likely to learn undefined behaviour from compiler warnings than reading a merry array of 500 page books before sitting down to not finish a program.
- angersock 12y agounless you knew all of it, pretty much, you couldn't really use any of it safely. Thank you for perhaps the best summation of everything wrong with using C++ in a project, and everything wrong with C++ as a language!
- throwawayaway 12y agoi also disagree with that statement, while amusing, it's untrue. you can use C++ without the things I have mentioned quite safely. in fact the less features you use, the less they interact and the safer the whole experience is.
- angersock 12y agoYou know what we call (C++)--? C. :)
- throwawayaway 12y agoyou should actually preincrement there to avoid the copy constructor, the correct formulations is (++C)--
- angersock 12y agoHow do you know that my preincrement and postincrement are the same? ;) Well played, at any rate.