Herb Sutter
herbsutter.com · Personal blog · on HN since 2010
Herb Sutter, a C++ standards committee leader, writes about C++ language design, standards, and his cpp2 experiment.
What HN saysHN links it for his 2012 post on Visual C++ and C support, and his talk describing cpp2 as a TypeScript for C++.
204HN people shared it
115linked it in comments
169stories submitted
3.6Kstory points
3 months agolast shared
2010people per year2026
Most-shared posts
- 1The Moore's Law free lunch is over. Now welcome to the hardware jungle.20 people · 168 points · first shared 2011 · 75 comments on HN
- 2Metaclasses: Thoughts on generative C++10 people · 144 points · first shared 2017 · 115 comments on HN
- 3Herb Sutter confirms no more support for C beyond C90 in Visual C++10 people · 49 points · first shared 2012 · 47 comments on HN
- 4Almost Always Auto (2013)10 people · 1 points · first shared 2014 · discussion on HN
- 5C++ Lifetime profile v1.0 posted7 people · 91 points · first shared 2018 · 48 comments on HN
- 6Revised GotW7 people · 1 points · first shared 2013 · discussion on HN
- 7Why the C++ standard ships every three years6 people · 239 points · first shared 2019 · 220 comments on HN
- 8C++ 20 embraces design by contract6 people · 14 points · first shared 2018 · discussion on HN
- 9Should you use smart pointers in function parameters?6 people · 3 points · first shared 2014 · discussion on HN
- 10C++ Safety, in Context5 people · 145 points · first shared 2024 · 364 comments on HN
- 11Herb Sutter "Three Cool Things in C++26"5 people · 6 points · first shared 2010 · 1 comments on HN
- 12Reader Q&A: What does it mean to initialize an int?5 people · 6 points · first shared 2024 · 1 comments on HN
- 13Elements of Modern C++ Style4 people · 148 points · first shared 2011 · 61 comments on HN
- 14Atomic Weapons: The C++ Memory Model and Modern Hardware4 people · 77 points · first shared 2015 · 22 comments on HN
- 15Trip June 2025 ISO C++ standards meeting (Sofia, Bulgaria)4 people · 15 points · first shared 2025 · 1 comments on HN
What HN people wrote when they linked it
zengid · 2018-04-11
The CppCon videos [1] are a great resource, but you'll have to thread your way through the wide variety of topics.
The videos from Herb Sutter [2] will usually emphasize best practices and give great examples, although he expects the audience to have a good bit of familiarity in regards to 'modern' c++ elements (C++11 and beyond).
[1] https://www.youtube.com/channel/UCMlGfpWw-RUdWX_JbLCukXg
[2] https://herbsutter.com/
pjmlp · 2026-08-10
They officially saw no need for C support going forward.
https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99
Note,
"If you really need either of the following.....then we recommend that you consider using a different compiler such as Intel or gcc (short-term) and/or pressure your standards committee representatives to have ISO C++ include more of the C standard (longer-term)."
Which is kind of why nowadays clang is part of Visual Studio as well.
However, after Satya got into the whole Microsoft <3 FOSS, this changed a bit,
https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-ar…
There are a few blogs after that, so at least up to C17 minus the optional parts from C11, the support is there.
It remains to be seen if anything C23 or later will ever come into MSVC, and then again, clang is part of VS installer.
AlotOfReading · 2025-11-10
It's worth differentiating the case of a specific program from the more general case of memory safety as a language feature. A specific program might take additional measures appropriate to the problem domain like static analysis or using a restricted subset of the language. Memory safety at the language level has to work for most or all code written using that language.
Herb is usually talking about the latter because of the nature of his role, like he does here [0]. I'm willing to give him the benefit of the doubt on his opinions about specific programs, because I disagree with his language opinions.
[0] https://herbsutter.com/2024/03/11/safety-in-context/
flohofwoe · 2024-10-15
Funny because for a long time the Microsoft MSVC team explicitly recommended compiling C code with a C++ compiler because they couldn't be arsed to update their C frontend for over two decades (which thankfully has changed now) ;)
https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/
d0mine · 2024-09-08
cpp2 is "A Typescript for C++" is how the author himself categorizes it https://herbsutter.com/2023/08/13/my-c-now-2023-talk-is-online-a-types…
Yes, knowing underlying levels of abstraction may be useful e.g., godbolt.org is excellent, knowing CPU caches, pipelines, branch prediction, out-of-order execution may be essential for getting orders of magnitude improvement in performance.
It doesn't mean the abstraction itself is useless.
yongjik · 2021-06-22
I think it's basically the same problem as unique_ptr? This is the best explanation I've seen: https://herbsutter.com/gotw/_102/
MaxBarraclough · 2020-01-02
> There are 2 normal ways to do things: work until you achieve the functionality you want and release it when that happens or work until an arbitrary date and release whatever you have at that point.
Wise words. Herb Sutter wrote a long blog post on exactly this, with regard to how C++ language versions release on a schedule, whether or not your favourite feature is ready yet.
https://herbsutter.com/2019/07/13/draft-faq-why-does-the-c-standard-sh…
jez · 2019-11-06
This is a great reply and I think it echoes what I've seen written elsewhere. For example, this one by Herb Sutter:
https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-param…
landtuna · 2018-03-07
Once you've got the basics down from a tutorial (old C++ or modern C++), move on to internalizing all the lessons here:
https://isocpp.org/faq (what Marshall Cline's excellent C++ FAQ has become)
and here:
https://herbsutter.com/gotw/ (Not as organized, but Herb Sutter wrestles with the essential questions of how to deal with the tricky bits of C++)
If you've got the cash, read Effective Modern C++ by Scott Meyers.
Finally, if you're ready to snark at all you've learned, read the C++ FQA:
http://yosefk.com/c++fqa/
jcelerier · 2018-01-28
> This is something I’d love to see changed in an upcoming C++ standard. (I lose track of exactly what we are or aren’t getting with whatever’s coming next so it’s possible it is already...)
https://cppx.godbolt.org (and https://herbsutter.com/2017/07/26/metaclasses-thoughts-on-generative-c…
tybit · 2017-11-02
As the article starts out with, Algebraic Anny, Boilerplate Billy etc wanting different things, I wonder if rather than side stepping this issue with a compromise if they could solve it with metaclasses as proposed for C++ https://herbsutter.com/2017/07/26/metaclasses-thoughts-on-generative-c…
I really like the idea of metaclasses and would love to see proposals for C# and Java too. As the proposal mentions Java and C# have already gone down a separate path with interfaces (and structs for C#) but would be cool to see if it could be resolved anyway.
andythemoron · 2017-07-25
Julia Evans' blog is one of my favorites! It was a big inspiration for starting my own blog (https://andythemoron.com). I also love High Scalability and Dan Luu's blog which have been mentioned in other comments.
I "follow" several which are mostly defunct, but in terms of blogs that still feature active updates:
Evan Klitze's blog: lots of topics around Linux, C++, etc. https://eklitzke.org/
Sutter's Mill: lots of "state of the world" for C++, but also context, history, etc. https://herbsutter.com/
IT Hare: C++, game programming http://ithare.com/
The Erlangelist: Erlang/Elixir http://theerlangelist.com/
null program: lots of miscellaneous topics http://nullprogram.com/
Fluent C++: the name speaks for itself http://www.fluentcpp.com/
Another Programmer's Blog: Linux, C, C++, C#, MSSQL https://www.stev.org/
stargrazer · 2017-07-10
I think the best summary of how to do this is to take a look at Herb Sutter's three article set on "Minimizing Compile-Time Dependencies". https://herbsutter.com/gotw/
"The Compilation Firewall", or pimpl idiom, is a clever mechanism for getting code out of the header: https://herbsutter.com/gotw/_100/
bdrool · 2016-03-04
On that note, these links are the best place to start when it comes to writing "good" C++ these days:
https://isocpp.org/blog/2015/09/stroustrup-cppcon15-keynote
http://herbsutter.com/2015/09/27/my-talk-at-cppcon/
https://github.com/isocpp/CppCoreGuidelines
danra · 2016-02-14
No.
In Herb Sutter's words, avoiding auto since it makes the code "unreadable":
...reflects a bias to code against implementations, not interfaces. Overcommitting to explicit types makes code less generic and more interdependent, and therefore more brittle and limited. It runs counter to the excellent reasons to “write code against interfaces, not implementations”
See http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-alw…
Someone · 2014-12-15
Herb Sutter's Guru of the week is a nice collection of gotchas/best practices: http://herbsutter.com/gotw/
And of course, his books (More) Exceptional C++ (http://www.gotw.ca/publications/xc++.htm, http://www.gotw.ca/publications/mxc++.htm) also contain nice examples.
jobu · 2014-09-17
Yes, and he's said that in a few blog posts as well:
http://herbsutter.com/2013/06/07/gotw-92-solution-auto-variables-part-…
http://herbsutter.com/2013/06/07/gotw-93-auto-variables-part-2/
http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-alw…
He has some good points, but his perspective seems to be biased by a professional focus on writing libraries and more general-purpose code. He's also brilliant and can remember things like this:
const int& cir = val;
auto h = cir;
//The type of h is int.
It's difficult to make generic rules for how to use C++ (because it's used for everything from adware to nuclear reactors), but I can say that Herb's AAA (Almost Always Auto) rule would not fly on any development team I've ever worked with.
taspeotis · 2013-12-11
This one [1] surprised me.
Q1: Is the following code legal C++?
string f() { return "abc"; }
void g() {
const string& s = f();
cout << s << endl; // can we still use the "temporary" object?
}
[1] http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-impo…
thomasjames · 2013-07-23
For those who are equally disturbed by some of the graphs, Herb Sutter's "Welcome to the Jungle" makes for a great read: http://herbsutter.com/welcome-to-the-jungle/
gtani · 2010-04-13
OK, let me try to be more helpful. Here's good backgrounders
http://www.tbray.org/ongoing/What/Technology/Concurrency/
http://www.sauria.com/blog/2009/10/05/the-cambrian-period-of-concurren…
http://groups.google.com/group/clojure/browse_thread/thread/5c7a962cc7…
http://blogs.azulsystems.com/cliff/2008/09/jvm-language-su.html
http://wiki.jvmlangsummit.com/pdf/36_Click_fastbcs.pdf
---------------------
also recommended: Herlihy/Shavit book, blogs by Sutter and Duffy,
http://www.amazon.com/Art-Multiprocessor-Programming-Maurice-Herlihy/d…
http://herbsutter.com/
http://www.bluebytesoftware.com/blog/Default.aspx
inetknght · 2025-09-01
> I don't have enough time to watch these kinds of presentations.
Then let me pick and share some of my favorites that I found enlightening, and summarize with some information that I found useful.
By far, the most useful one is Khalil Estell's presentation last year [0]. It's a fairly face paced but relatively deep dive into exception mechanics. At the end, he advocates for a new tool that would audit a program to determine what exceptions could be thrown. I think that's a flipping fantastic idea for a tool. Unfortunately I haven't seen any progress toward it -- if someone here knows where his tool is, or a similar tool, please reply! I did send him an email a few months ago inquiring about it, but haven't received a reply. Nonetheless, the whole presentation was excellent in my opinion. I did see that he had another related presentation at ACCU this year [4] with a topic of "C++ Exceptions are Code Compression" (which I totally can believe -- I've seen it myself in binary sizes), but I haven't seen his presentation yet. I'll watch it later today.
Just about anything from Herb Sutter is good. I don't like that he works for Microsoft, but he does great stuff for C++, including the old Guru of the Week series [1]. In particular, his 2019 presentation [2] describes different error handling techniques, some difficulties and pitfalls in combining libraries with different error handling techniques, and leads up to explaining why std::expected came about. He does pontificate a…
maxlybbert · 2025-08-15
When the STL became part of the standard library ( http://www.stlport.org/resources/StepanovUSA.html ), there was a question of how to handle algorithms that sort containers, or that perform a binary search, or in some other way, need to know whether “a” is less-than, equal-to, or greater-than “b”. The algorithms have to work on primitive types, and user defined types as efficiently as possible. They eventually decided to only require a function for “less-than.” And if “a < b” returns false, and “b < a” also returns false, then “a” and “b” are considered equal.
There are times that doesn’t work, so documentation usually has a footnote that (1) certain algorithms require a partial ordering and not necessarily a total ordering, and (2) to use those algorithms, you must implement less-than, but any other comparison operator is ignored by the algorithm; instead, less-than is used to figure out greater-than and equal-to as needed. This was considered better than requiring programmers to implement a collection of comparison operators, and trusting those programmers to make those operators act consistently with each other (e.g., never say that “a” and “b” are both less-than and greater-than each other).
The spaceship operator seems to address this specific case ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0515r0.pdf ). According to Herb Sutter (note that his name is on the proposal), “We added the C++20 spaceship operator to the language, but we also applied it…
dxuh · 2023-05-04
There is this guideline of "Almost Always Auto" (https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-al… and I have been following it for yeears both in my job and my personal projects and I have never been very confused by it or had any sort of bug because of it. I felt very reluctant about using it at all for quite a while myself, but in practice it just makes stuff easier and more obvious. A huge reason it's useful in C++ is generic code (stuff that depends on template parameters or has many template parameters) or deeply nested stuff (typing std::unordered_map<std::string, MyGreatObject::SomeValue>::iterator gets annoying), but it's nice almost everywhere.
Most types are repeated and getting rid of those repetitions makes refactorings a lot easier and gets rid of some source of bugs. For example sometimes you forget to change all the relevant types from uint32_t to uint64_t when refactoring some value and stuff breaks weirdly (of course your compiler should warn on narrowing conversions, but just to illustrate the point, because it is very real).
mattnewport · 2019-02-24
"Coroutines (Gor Nishanov) was adopted for C++20. A number of other authors that have their own coroutine proposals have also done great work to give feedback to this design and inform the committee in the process of showing their own designs, and the adopted coroutines design is expected to adopt some of their additional programming capabilities in the future as well as we continue to build on it after C++20. At this meeting, we had many detailed design discussions, including notably these papers that will be available in a few weeks when the post-meeting mailing is posted: a unified consensus report from all coroutines proposers describing the strengths and weaknesses of all their proposals, and a consensus report from implementers from all major C++ compilers about the tradeoffs and feasibility of the basic facilities required by the various coroutines proposals. Both of these papers are very educational and highly recommended."
https://herbsutter.com/2019/02/23/trip-report-winter-iso-c-standards-m…
The papers aren't available yet but presumably will explain the reasoning behind accepting them in their current form.
0xFFC · 2017-11-02
Are they really going to add $ to C++? Unbelievable. What was wrong with "reflexpr"? It is way more C++'ish than "$".
Update: From Herb's blog :
"Also, a vocal minority in the committee strongly want a syntax that does not include the $ character (not just for $class, but also for $expr reflection) because they have large code bases that use $ in source code that is not C++ code but is processed to emit C++; removing $ is an easy change at any time and we’ll just follow what the committee decides for reflection syntax (in fact, the alternative syntax I showed in the endnote above removes the need to write $). So further work is needed on those items, but fortunately none of it affects the core model."
https://herbsutter.com/2017/07/26/metaclasses-thoughts-on-generative-c…
P.S. I really hope that vocal minory would win ;)
But overall the proposal is what I have been talking about for a long time.
cyber1 · 2017-09-27
I think TiKV is a good example where team chose Rust over Modern C++. Rust gives the same performance and is close to metal like C when it is necessary. All possible memory management mistakes it catches at compile time if it's not "unsafe" and this is a really great!
With Rust I can hack without fear! I shouldn't remember tons of C++ rules which are described in http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines, "C++ programming language" book, also here https://herbsutter.com/gotw/, etc and I can focus on algorithms and implementation.
C++ combines a lot of different paradigms m.b. more correct I would like to say "C++ paradigms hell"! Which of C++ subsets is the right way, no one understands. Even Bjarne Stroustrup said, "Within C++, there is a much smaller and cleaner language struggling to get out." - and where is this "smaller and cleaner language"?. What is the idiomatic style in C++? Is it Google guidelines, CoreCpp guidelines or other enormous guides?
I look inside a lot of C++ projects and each of them has different styles, use different paradigms, sometimes look like different languages!
Rust, Go, C, Java code bases look the same, they have their own idiomatic style, their own way.
I think Rust is the next step in the evolution of system programming language.
cechner · 2014-08-19
hey, I updated the post (though I didn't lower the polemic attitude!)
I just added links to several of Herb Sutters articles (e.g., http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-alw… ) and Scott Meyers talk (http://vimeo.com/channels/ndc2014/97318797 )
They say it better than I really could, and they say it very emphatically. I think the general consensus amongst the C++ leadership is to use auto when possible, for more reasons than I had considered.
edit: I notice you also object to 'appeals to authority'. In this case I am not saying do it because all of the known C++ authority tell you to do it, but indicating that they /also/ recommend it, hopefully adding more weight to the argument
Also, what's wrong with appealing to authority on difficult subject matter? Whats the point of attending Scott Meyers' lectures at all if you aren't going to heed his advice???
pron · 2013-10-09
Contention is not binary, or, rather, its effects aren't binary. A lock that is held for 10 microseconds potentially causes a lot more contention than a CAS that takes a few nanos. OTOH, thousands of short contentions are as bad as, or worse, than few long contentions (there's a whole great talk by Doug Lea about how Java's fork/join tricks modern CPU out of crazy power-saving optimizations to reduce thread wakeup time).
Intel's TBB were modeled after java.util.concurrent, BTW. Later, the Java memory model inspired the C++11 memory model (and the Java people were called to help with that, too). When it comes to concurrency, Java is usually at least 5 years ahead of C++ (perhaps with the exception of fork/join, which was inspired by Cilk, but has since come to surpass it).
> I'm not sure what is so hard about Hazard Pointers
Hazard pointers are expensive without RCU (the hazards need to be visible to other threads, which means store-load barriers), and RCU requires kernel cooperation, and besides this entire class of techniques is either very limited or incredibly complicated (what do you do if you have thousands of threads?). A good GC vs hazard pointers with or without RCU is like driving down a highway vs stumbling in a swamp when it comes to lock-free data structures.
Here's Herb Sutter on the issue (source: http://herbsutter.com/2011/10/25/garbage-collection-synopsis-and-c/):
All existing C++ garbage collectors, notably the Boehm collector, aren’t enough for many…
quotemstr · 2026-06-21
> Comparing it to nukes is a bit extreme, don’t you think?
Does Herb Sutter strike you as extreme?
https://herbsutter.com/2013/02/11/atomic-weapons-the-c-memory-model-an…
mananaysiempre · 2026-05-31
Pedantically, yes VLAs are a mandatory part of C99 (only). Practically, there has been some resistance so they were reverted to optional in later standards (in C11/17, the whole thing is optional; in C23, variably modified array types are mandatory but the ability to allocate arrays of such types on the stack is not). In any case, MSVC is quite a bad benchmark as far as C (not C++) standards conformance goes—it’s been quite some time since Sutter’s (in)famous post[1] and things have improved, but not to the point that I’d believe C to be a priority for Microsoft.
(Note MSVC has alloca—and Microsoft’s own libraries in the past have done unwise things with it—so the safety argument for the lack of support does not fly.
[1] https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/