A list of modern C++ features
11–20 of 68 posts
Re: A list of modern C++ features
#12Re: A list of modern C++ features
#13I really wish there would be a linter (I realise it's probably a nearly impossible task) which would complain when you use legacy, unsafe language features. As someone who doesn't work in C++ or have the benefit of 10 years experience to see the flaws, trying to write modern, safe C++ is essentially impossible. I spent a solid week trying to write something safe and only use C++14/17 features when they were available…
Besides the clang-tidy, there is the ongoing efforts to improve VS analyzers, but I guess they will only be fully productized on VS "15", the upcoming release.
I also imagine other C++ linters are improving their C++ Core Guidelines support.
Under C++ Core Guidelines you are supposed to use [[unsafe]] annotation to mark such features.
Re: A list of modern C++ features
#14This made me think of the passage below from Edsger Dijkstra's ACM Turing Lecture from 1972. Back then there was no C++. "I remember from a symposium on higher level programming language a lecture given in defense of PL/1 by a man who described himself as one of its devoted users. But within a one-hour lecture in praise of PL/1. he managed to ask for the addition of about fifty new “features”, little supposing that t…
Yes C++ is complex, but so are Python, Ruby, Ada, Fortran, C#, F#, Haskell, OCaml, Java...
Even Go will get caught in the complexity game if it gets enterprise adoption at scale.
If not the language, the libraries surely will.
Re: A list of modern C++ features
#15Earlier quoted context omitted.
clang-tidy does this (or is working towards doing this) http://clang.llvm.org/extra/clang-tidy/checks/list.html
Thanks, that page looks like hell, but I recognise a few terms. http://clang.llvm.org/extra/clang-tidy/ is much more approachable, and gives a solid overview. The introductory sentence gave me project-naming cancer: > clang-tidy is a clang-based C++ “linter” tool. Then why is it called tidy ??? It appears first on page three of google's search results for "C++ linter" in spite of the fact that anything from LLVM is p…
Re: A list of modern C++ features
#16Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values in functions and other minor improvements to C. I don't want to reimplement the n'th version of string concatenation when I can just use the "+" operator, sure... and there starts the rabbit hole. Before you know it you have a "protected abstract virtual base pure virtual private destructor" and have to explain the new hired mathematician who only has experience in R what the fuck you are doing.
Re: A list of modern C++ features
#17Yeah more features is exactly what C++ needed... Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values in functions and other minor improvements to C. I don't want to reimplement the n'th version of string concatenation when I can just use the "+" operator, sure... and there starts the rabbit hole. Before you know it you have a "protected abstract virtual base…
Re: A list of modern C++ features
#18Yeah more features is exactly what C++ needed... Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values in functions and other minor improvements to C. I don't want to reimplement the n'th version of string concatenation when I can just use the "+" operator, sure... and there starts the rabbit hole. Before you know it you have a "protected abstract virtual base…
I'd say unfortunately not. Focussing on the classes has the disadvantge it can quickly lead to 'everything is an object' or derived strict OOP mindsets thereby not only ignoring tons of other, more functional, goodies modern c++ has to offer but also leading to what you call 'protected abstract virtual base pure virtual private destructor'.
Re: A list of modern C++ features
#19This made me think of the passage below from Edsger Dijkstra's ACM Turing Lecture from 1972. Back then there was no C++. "I remember from a symposium on higher level programming language a lecture given in defense of PL/1 by a man who described himself as one of its devoted users. But within a one-hour lecture in praise of PL/1. he managed to ask for the addition of about fifty new “features”, little supposing that t…
And every time there was a language designed against PL/I like languages, with the goal of fighting complexity, its adoption by the industry lead to feature growth and becoming just as complex, usually with solutions hindering by backwards compatibility. Yes C++ is complex, but so are Python, Ruby, Ada, Fortran, C#, F#, Haskell, OCaml, Java... Even Go will get caught in the complexity game if it gets enterprise adopt…
Its not a "complexity game" in so much as poor design being over-compensated for. C++ is like cancer infecting the minds of young programmers with buggy habits -- and no amount of features and static analysis will change what lies beneath... :p
Re: A list of modern C++ features
#20The things I dislike most are pairs and tuples. They make the code enormously harder to read, understand and debug, compared to non-standard classes or structures with meaningful member names. Even this guide promotes them in “using Coordinate = std::pair;” Please, never do that, create your own class with x/y or latitude/longitude instead.