TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A list of modern C++ features

167 pointsby deepakkarkiover 8 years ago

11 comments

codebeakerover 8 years ago
I really wish there would be a linter (I realise it&#x27;s probably a nearly impossible task) which would complain when you use legacy, unsafe language features.<p>As someone who doesn&#x27;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&#x2F;17 features when they were available, and encountered a mountain of outdated- and mis-information about what one can and can&#x27;t do, what is and isn&#x27;t considered safe and why one certain feature is better than another.<p>It&#x27;s nobody&#x27;s fault that this happens, but with C++14 apparently fast becoming a language that is addressing it&#x27;s #1 pitfall (safety) in an apparently very adequate way, it&#x27;s frustrating that there&#x27;s no &quot;safe code&quot; linter to stop rookies stepping on landmines.<p>Thanks for the list, it&#x27;s a solid start, and the sibling comment about C++ Core Guidelines is another solid resource.
评论 #12948374 未加载
评论 #12948598 未加载
评论 #12948347 未加载
sprashover 8 years ago
Yeah more features is exactly what C++ needed...<p>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&#x27;t want to reimplement the n&#x27;th version of string concatenation when I can just use the &quot;+&quot; operator, sure... and there starts the rabbit hole. Before you know it you have a &quot;protected abstract virtual base pure virtual private destructor&quot; and have to explain the new hired mathematician who only has experience in R what the fuck you are doing.
评论 #12948991 未加载
评论 #12950151 未加载
评论 #12950547 未加载
评论 #12948917 未加载
augustkover 8 years ago
This made me think of the passage below from Edsger Dijkstra&#x27;s ACM Turing Lecture from 1972. Back then there was no C++.<p>&quot;I remember from a symposium on higher level programming language a lecture given in defense of PL&#x2F;1 by a man who described himself as one of its devoted users. But within a one-hour lecture in praise of PL&#x2F;1. he managed to ask for the addition of about fifty new “features”, little supposing that the main source of his problems could very well be that it contained already far too many “features”. The speaker displayed all the depressing symptoms of addiction, reduced as he was to the state of mental stagnation in which he could only ask for more, more, more...&quot;<p><a href="https:&#x2F;&#x2F;www.cs.utexas.edu&#x2F;~EWD&#x2F;transcriptions&#x2F;EWD03xx&#x2F;EWD340.html" rel="nofollow">https:&#x2F;&#x2F;www.cs.utexas.edu&#x2F;~EWD&#x2F;transcriptions&#x2F;EWD03xx&#x2F;EWD340...</a>
评论 #12948622 未加载
slackaover 8 years ago
Good supplementary material to the C++ Core Guidelines.[1] If you haven&#x27;t checked it out yet, both VS 2015 and clang offer checkers[2]<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;isocpp&#x2F;CppCoreGuidelines" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;isocpp&#x2F;CppCoreGuidelines</a><p>[2] <a href="https:&#x2F;&#x2F;reviews.llvm.org&#x2F;diffusion&#x2F;L&#x2F;browse&#x2F;clang-tools-extra&#x2F;trunk&#x2F;clang-tidy&#x2F;cppcoreguidelines&#x2F;" rel="nofollow">https:&#x2F;&#x2F;reviews.llvm.org&#x2F;diffusion&#x2F;L&#x2F;browse&#x2F;clang-tools-extr...</a>
mschuetzover 8 years ago
C++11 and C++14 made me start to like C++. The build workflow is still horrible and cumbersome but at least the language itself has become nice to use.
jonathanstrangeover 8 years ago
It&#x27;s a monster language, the Godzilla of the programming languages. But it gets the job done, as long as you use only 10% of its features.
评论 #12950954 未加载
评论 #12950421 未加载
lotuover 8 years ago
The one feature that really annoys me is the std::optional. This is awesome and very needed feature however it is too clunky for something that should be used very frequently. Swift does such a nice job with its &#x27;?&#x27; operator, I wish C++ had something similar.
评论 #12950638 未加载
reacharavindhover 8 years ago
I really wish a group of really smart dev get together and come up with a new language based just on the modern C++. Perhaps even call it MC++ (Modern C++). Make it&#x27;s syntax as simple and easy to learn as Python and yet give us the performance close to the compiled C++. I&#x27;d take that knowing very well that I can&#x27;t do all the powerful stuff I could with C, yet I have a safe and idiot-proof language to work with in my hands.
评论 #12957563 未加载
评论 #12951676 未加载
评论 #12954053 未加载
评论 #12953193 未加载
评论 #12951331 未加载
mockeryover 8 years ago
Nice summary! As someone who writes multi-platform C++, it would would be even greater (but a lot more work) if each feature listed which version of each major compiler introduced support. (ie. Can I use this feature if my codebase is currently compiling under given versions of Clang, GCC, VS.)
评论 #12948103 未加载
Const-meover 8 years ago
Most features are very good. My favorite ones are range-based loops, lambdas, and strongly-typed enums.<p>The 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&lt;int, int&gt;;” Please, never do that, create your own class with x&#x2F;y or latitude&#x2F;longitude instead.
评论 #12950733 未加载
评论 #12950589 未加载
wmuover 8 years ago
It is worth to note that template-related features make compilation time significantly longer. It might seem no-problem unless you face it in a bigger team, then these extra seconds (or minutes) are multiplied.