3 ms·
Great slides. This is the first time I am seeing a direct C++03 and C++11 comparison. Makes it much easier to understand. That said, c++11 is a language that w
by general_failure 13y ago
Great slides. This is the first time I am seeing a direct C++03 and C++11 comparison. Makes it much easier to understand.
That said, c++11 is a language that wants to be everything. Functional, object oriented, procedural, imperative, declarative and what not. The end result is slush.
- eksith 13y agoSlush is possible in C++03 as well. I'd say C++11 is trying to be humane as possible in that regard and not destroy the program (or the output) on account of programmer idiosyncrasies, no? What I would much rather prefer is a "from scratch" approach to learning C++11 (assuming no prior knowledge about programming, but having a basic knowledge about memory etc...) That would really help curb the tide of novice programmers seduced by sexier languages that have no concept of safety, efficiency and correctness.
- asdfgP 13y agoA good introductionary book about C++11 is "C++ Primer": http://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/0321714113 http://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/032171... What I like about this book is that it teaches you the new C++ way right from the beginning. Rather than walking you through the history of C, it gets you to the modern practices immediately. Disclaimer: I have only read the first 10% of the book myself, but so far I like it.
- stephen_g 13y agoSlush? Depends how you use it. It's extremely easy to write horrible C++ code, but when used by a talented developer I think the result can be extremely elegant. I like how it's a lot more expressive than C, but without the needless verbosity of a language like Java.
- betterunix 13y agoC++ still has quite a bit of needless verbosity. You need to explicitly specify how variables should be captured in lexical closures. You need to explicitly choose weak pointers versus non-weak pointers. There are few useful defaults; you are forced to explicitly write a lot of boilerplate as a result. It may be better than Java, but that is not saying much.
- kybernetyk 13y ago> You need to explicitly specify how variables should be captured in lexical closures. I prefer that to some "it's automagically captured" behavior (in the context of C++). At least so I know and can choose if the closure captures a reference or makes a copy - which can be a very important detail. For the stuff I usually do in C++ I love this kind of freedom. For other stuff where speed and/or memory layout/usage are not that important there are higher level languages like Python or Common Lisp.
- betterunix 13y agoIt seems to me that you could just as easily always create a copy of the captured variable, and in cases where you want to capture a reference, just create a reference to the variable and capture that instead. That is exactly what you see people doing when they capture "smart" pointers. You would not lose any freedom if captured variables were always copied, you would still be able to avoid expensive copy operations as needed (or just fix the problem at its source by making copying less expensive). A high level feature like lexical closures should not get bogged down with low-level details (like the mechanics of how variables are captured). It's a waste of time and mental energy, distracting programmers from important issues and making debugging more complicated and time-consuming. Spending time deciding which method of capturing variables is faster screams "premature optimization."
- pjmlp 13y ago> That said, c++11 is a language that wants to be everything. Functional, object oriented, procedural, imperative, declarative and what not. You can state the same for any multi-paradigm language.
- jadyoyster 13y agoAll those "paradigms" are artificial distinctions and can be used together perfectly well. Why do you consider mixing them bad?