3 ms·
You should look at "Back to the Basics! Essentials of Modern C++ Style" talk from Herb Sutter at CppCon 2014[1]. You'd have a great insight on why 'auto' isn't
by Ragnarork 12y ago
You should look at "Back to the Basics! Essentials of Modern C++ Style" talk from Herb Sutter at CppCon 2014[1]. You'd have a great insight on why 'auto' isn't just some kind of "convenience" keyword and why it matters.
[1] https://github.com/CppCon/CppCon2014/blob/master/Presentations/Back%20to%20the%20Basics!%20Essentials%20of%20Modern%20C%2B%2B%20Style%20-%20Herb%20Sutter%20-%20CppCon%202014/Back%20to%20the%20Basics!%20Essentials%20of%20Modern%20C%2B%2B%20Style%20-%20Herb%20Sutter%20-%20CppCon%202014.pdf https://github.com/CppCon/CppCon2014/blob/master/Presentatio...
- JoeAltmaier 12y agoOh I see it can matter. But it may become intractable. Using 'const' matters, but few achieve it - even std library methods rarely use it for immutable arguments, so if I try to use const I end up casting to non-const to call down.
- vinkelhake 12y ago> even std library methods rarely use it for immutable arguments Can you give some examples of methods in the standard library that should use const, but doesn't?
- ansgri 12y agoThanks for the link! Now I know what to tell my students next time. C++ is the language of choice for recognition systems development anyway, and with C++14 it's actually starting to become beautiful.
- pjmlp 12y agoC++11 and C++14 removed many of my complaints about the language (I use it on and off since 1993). Still waiting for modules though. The biggest problem are the pre-C++98 codebases or the ones full with C idioms instead of modern C++. Those aren't going away anytime soon.
- Ragnarork 12y ago> The biggest problem are the pre-C++98 codebases or the ones full with C idioms instead of modern C++. Thanks for pointing that out. THIS is the real problem of C++. Not the language spec (though it can and has to be improved with time), but those codebases, which incidentally make perfectly sane people go nuts about C++... :)
- millstone 12y agoI disagree very strongly with the argument presented there - in fact, I think it provides enough rope to hang itself. It says: 1. With deduction you always get right type 2. Deduction guarantees no implicit conversion will happen From this we can conclude that "the right type" never involves an implicit conversion. This is false: see vector<bool>::operator[], or consider the fact that auto allows you to make a variable of a type you cannot name explicitly (i.e. is private), which is surely not "the right type!"