11 ms·
C++17 Is Here: Interview with Herb Sutter
- jerrre 9y agoNot directly related, but a question that popped up while reading this: As a C++ programmer I'm quite happy to see the language keep improving in quite a good pace, but I'm wondering if anyone can shine some light on how this evolution compares with other widely used languages. Of course newer languages can change drastically quite fast (Swift comes to mind), but I don't follow more accomplished languages (PHP, Java, JavaScript, Python, Even C, ..., sorry if I didn't name your language) close enough to get an idea.
- deleted 9y ago[deleted]
- grabcocque 9y agoThe poster below can go fuck himself.
- unfamiliar 9y agoThe question was about how evolution of each language was handled, not a general comparison of languages.
- grabcocque 9y agoHence why I said "I'd say Rust is pushing in the same direction of travel as modern C++"
- dang 9y agoWe ban accounts that vandalize HN with comments like this one. Please read https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and don't do this again.
- dtech 9y agoThat's quite a list of languages. Here's my opinion on a few that I know: My impression of C++ is that is evolves fairly quickly, but also includes everything, the kitchen sink and the highway, making for an expansive and complex language. Scala gets some of the same flak. Java evolves glacially, and outside of very rare large improvements (e.g. lambda's in 8) it's still the same (verbose) language and will remain for a long time. PHP evolves fairly quikly, but the API's aren't consistent leading to a bit of the "flavor of the week" feeling for new additions. I don't know how this has been since PHP 7+ Javascript is evolving at a rapid pace, but despite that they seem to move toward a clear goal with nice functional API's and constructs being added to the language.
- FranOntanaya 9y agoPHP 7+ hasn't added that much in terms of new APIs — (e.g. libsodium in 7.2, and it's typical function(target, arguments) stuff). It added strict typing and a very significant bunch of ergonomic/performance changes. I'd say half the reason to call it a quick evolution is how fast it's being adopted compared with the glacial progress from 5.2 to 5.6, or Python 2 to 3. Also a third half of the freshness has been adoption of packaging and coding standards.
- criddell 9y agoTo me, C++ felt stuck for a pretty long time during the 2000's. Maybe that was due to being stuck in Microsoft-land. These days, C++ on Windows is great.
- ksherlock 9y agoc++(19)98 was the first c++ standard. There was a minor update in 2003 to fix the most obvious defects. The next standard was c++11. If it felt stuck in the 2000s, it's because it was stuck in the 2000s. And it wasn't just Windows/Microsoft - To this day, gcc 4 (-std=c++0x if you want some c++11 features) is the standard compiler for many Linux sites.
- eco 9y agoThe reason that the standard stayed unchanged for so long after 2003 is that the committee had a misunderstanding about some ISO rule and thought they couldn't release new versions for some period of time. I can't remember the details but Herb Sutter has mentioned it during conferences.
- zanny 9y agoC++ is old. It inherits most of C, which is also old. No other language has had to maintain backwards compatibility for roughly ~40 years, through generations of programming paradigms, while also trying to stay relevant. Modern C++ is a ton of new functionality mostly because its adding another paradigm to the language - since C++11 it has gotten much more functional. Just look at how Python ended up if you want to see what happens when you try to backwards-break a language. And C++ is oh so much worse at that - if you make a non-compatible language iteration it would also (probably) break the ABI, which means "new" C++ cannot link old C++. It would make two languages. And nowadays, you really only have one of three reasons to write C++: * You already have a C++ project. * You need to use a C++ library / supporting code / integrate with C++ directly (and not through a C API). * You want a feature only a C++ construct / library can provide. Qt is a great example of this, because there really is nothing comparable to it on any other platform in terms of a cross platform native UI toolkit, and using bindings can work but introduces a lot of build system complexities. So C++ has all the reasons to adopt new paradigms to make life easier for those who have to use C++, but breaking backwards compatibility defeats all the core reasons you want to use the language. A prettier language is useless if you cannot get real work done in it.
- fatbob 9y agoHow about real-time control? What's the alternative?
- pjmlp 9y agoAda, SPARK, Pascal, code generation using formal model, in some soft-real time cases Java (RTSJ 2.0). But it will be an up-hill battle if not working alone, unless one is working in high-integrity related industries.
- jononor 9y agoHopefully Rust will eat up the real-time domain, at least for tasks which aren't best served with formal or model-based methods. It might already be usable, most of the essential pieces seem to be in place. No GC, many parts of stdlib, typed arena for memory pools etc. Move operations and immutable by default should reduce tendencies for defensive copying. But best-practices, documentation and tooling for real-time is not on par with C++ yet. Though real-time is an underdocumented art in general..
- smitherfield 9y agoFaster[1] than Java (glacial, albeit with warmer weather recently) or C (continental drift), slower than Swift, PHP (which truly has become a "kitchen sink" language equal to C++'s reputation for the same) or Python, about the same as Javascript.[2] [1] By which I mean the languages themselves and minimally-conforming standard libraries rather than ecosystems or quasi-standard libraries like J2SE (Java), Cocoa (Swift) or the browser DOM (Javascript). C++ has a fairly slow-moving (but mature) ecosystem and its "quasi-standard" libraries (Boost, common compiler extensions, Windows and POSIX APIs) aren't as tightly-coupled to the language as the previous three examples. [2] Both hindered by standards-body bureaucracy and the need to keep backwards compatibility with mistakes, but both popular enough that bigcorps are incentivized to keep things moving along; Javascript is more popular but that's offset by C++'s more efficient de facto process for standards-tracking library improvements (get them into Boost first). Javascript actually probably moves a bit faster but Internet Explorer compatibility (still likely to be relevant for another 5 years or so) is an even bigger drag on adopting bleeding-edge features than waiting for (your company adopting) new Visual Studio/CentOS GCC/[Some embedded architecture] GCC versions is for C++.
- shawncplus 9y agoSafari (specifically iOS Safari) is definitely a bigger drag on newer features than IE at the moment. IE is a known quantity and Edge has particularly good support. Safari, however, seems to be a case of Apple, ostensibly, making completely arbitrary decisions on what to include or not.
- inciampati 9y agoDoes anyone know the state of modules (so as to support something like npm) in C++?
- Longhanks 9y agoModules (in the C++ terminology) and a package manager like npm are two different beasts. Modules are not part of C++17, although Clang and MSVC both bake their own bread with implementation of the current modules draft.
- adrianN 9y agoIt's pretty bad: https://news.ycombinator.com/item?id=15440489 https://news.ycombinator.com/item?id=15440489
- humanrebar 9y agoThere are still issues being worked out. They are solvable, but there is a challenge in getting consensus on a particular set of decisions about how to implement modules.
- 72deluxe 9y agoStroustrup said he was disappointed with C++17 as it didn't introduce anything massive. You can see him mentioning this widely and openly at cppcon last year. It'll be interesting to see what gets in next.
- andrepd 9y agoWell concepts and modules, arguably the most important features C++ desperately needs, are still missing from this release.
- xfer 9y agoYeah, i was hoping for the long overdue death of header files.
- fnord123 9y agoeh, check that modules is what you think it is/should be: https://izzys.casa/posts/millennials-are-killing-the-modules-ts.html https://izzys.casa/posts/millennials-are-killing-the-modules... Modules without buy-in from build tools (or a fresh build tool) will probably be DoA as Isabella says.
- boris 9y agoThere is a fresh build tool that supports modules in the big three (GCC, Clang, and VC): https://build2.org https://build2.org
- steveklabnik 9y agoConcepts were merged into the C++20 draft, at least.
- kllrnohj 9y agoHerb Sutter's metaclasses proposal is what I'm most looking forward to which would go a long way towards addressing C++'s template craziness.
- 9y ago
- turbinerneiter 9y agoBeing new to C++, on of my biggest gripes is that I often feel unsure whether I'm using the right way to do things, or if I'm using an old method that was replaced by a new one. Especially given that I never took the time to properly learn the language, but mostly piece together SO answers ... . Is there a C++17-exclusive compiler-flag? Or linters that inform you about outdated concepts? Some way to get rid of the backwards compatible cruft when writing new things.
- aldanor 9y agoclang-tidy has a few 'modernize' type lints; it's far from comprehensive but it's something.
- kanwisher 9y agoThis is actually really troublesome, I coded a lot of c++ about 15 years ago. So initially I tend to write code thats old style. Googling samples is all over the place on what version its using. It would be nice if someone built a linter around this
- pjmlp 9y agoTrue, but it happens to any language that has been long around. I stopped following Python regularly around 2.2 timeframe and only use it occasionally as better shell scripts when on UNIX like systems. If I was to actually build an application with it, I bet my code wouldn't be very up to date with 3.7 Pythonic code.
- humanrebar 9y agoLook at the "modernize" checks in clang-tidy.
- xfer 9y agoNo, your best bet is to check cppreference.com to see when the method was introduced and learning from a recent enough book.
- pjmlp 9y agoThere is ongoing work to have linters advice on the Core Guidelines items, which are considered the best practices. https://github.com/isocpp/CppCoreGuidelines https://github.com/isocpp/CppCoreGuidelines For those that aren't aware, actually some of the input from Microsoft side was based in the work done with Midori and having System C# ideas applied to C++. VC++ with the code checkers and clang with clang-tidy. Not sure about the current state of gcc or other commercial C++ compilers.
- jokoon 9y agoSorry but I am going to complain again about modules. I mean I'm inches from making a petition so that compiler vendors can agree on something and move on. This would make the language much more attractive for new users, reduce compile time, etc. Please!
- pducks32 9y agoI do really love how C++ is evolving. The language is fighting and adapting and I think in a very smart way. This old dog can learn new tricks. I also love how often it makes me feel stupid at the incredible knowledge of it's maintainers and implementers.
- devrandomguy 9y agoWow, just thinking about C++ while slacking, was enough to inspire a solution to a race condition in my Clojurescript project. Earlier, I made some notes and walked away from the problem, because it was getting frustrating. Then, while I was checking this out, I started thinking "Imagine how complex this would have been if I had done it in C++" Then the immediately following thought was "Well, in C++, I would instead build it like so, because it needs to be thread safe." Problem solved, obvious-in-hindsight solution. Even though my problem wasn't caused by a low level threading mistake, thinking about the problem in the context of a more primitive tool helped me to better understand how my own tools are working.