Bjarne Stroustrup: “I Did It for You All” (2007)
harmful.cat-v.org
harmful.cat-v.org
This is satire. A parody based on Stroustrup's many defenses of C++.
It makes me laugh every time I read it. Some day, hopefully many years from now, I suspect someone will write "Bjarne's Deathbed Confession" with the exact same premise, just updated.
We know people say absurd things, so there is absolutely a need to clearly mark satire/humor
Tools like vcpkg paper over the horror that is cmake and more isolated build environments and could ultimately be de-facto, but even then things like mixed-version dependencies and system libraries are large barriers to entry in getting started and distributing serious work.
(This applies mostly to new projects adopting modern C++. Projects that are already established in my experience don't usually have to invest much in way of their tooling and build-system provided they're not adding new dependencies or platforms on a super regular basis. We recently upgraded a 100k+ SLOC program from C++17 to C++20 and only one or two very small things failed to compile. Once the system works the system tends to stay working.)
The standards committee has stayed away from delving into these issues. Perhaps with good reason. But without an official stance on how to go from "well-formed code to binaries" that covers real-world use-cases, it's hard to imagine C++ being new-learner-friendly.
Perhaps modules and other newer features will obviate some of those build-like features and the problem will be more tractable by the time C++25 (?) comes around.
Given that I've been working with C++ for nearly 30 years, have used autotools, cmake, meson and waf but have never heard of vcpkg, it seems unlikely to me that such a thing is going to be the de facto anything.
> But without an official stance on how to go from "well-formed code to binaries" that covers real-world use-cases, it's hard to imagine C++ being new-learner-friendly.
Binaries are platform specific (especially installers). I don't want my language (which should almost necessarily be platform independent) grappling with or trying to tell me how to deal with them.
Understanding that creating binaries is a potentially complex task that is largely (though not totally) independent of writing code is an important step for programmers working in compiled languages.
14.4k+ stars, and it's a product from Microsoft. It uses cmake under the covers (for now?). Doesn't mean it will win, but it's a contender.
> Binaries are platform specific
Yes? Each new platform has to be more or less officially adopted into a build-system. Maybe better one "official" build-system rather than dozens. Reduce the surface-area for adding a new platform and maybe it won't seem so herculean anymore.
> trying to tell me how to deal with them
An official build-system doesn't have to be any less feature-ful than the hodge-podge of current offerings.
> creating binaries is a potentially complex task that is [...] an important step for programmers
It doesn't need to be as complicated as it is today. And I don't think you intended it, but this last bit reads as dismissive and condescending.
Many of us veteran C++ folks are so used to the way things have always been that it's hard to imagine an alternate universe where a sane and powerful build-system was "in the language" from the start.
It may be a hard problem, but `cargo` has some interesting ideas, and I don't hear anyone complaining about not being able to do low-level and platform-specific things in Rust...
* that there is a canonical way to build every dependency
With this assumption in hand, they move to a conception in which you somehow make the dependencies available (canonically built) and then assemble your binaries (if not your actual installer) with this.But there is no canonical way to build lots of dependencies. Two reasons (at least);
* software libraries with build flags that totally change their behavior. One example that I deal with is libfftw which can be built for single-threaded or multithread use (and the two should not be used in the wrong context). Of course, this can be addressed by referring to each "version" with a different name, but if there are N build flags, that causes an explosion of possible variant names. Another example would include libraries that have hard-coded search paths (this is NOT automatically wrong) that are set at build time; the search paths may differ depending on the target platform. The "appropriate" location for dynamically-loaded modules, for example, differs even among Linux systems, because of the behavior of the system's dynamic linker. Plugins (compiled to dynamically-linked objects, loaded at run time based on user input) are always problematic because they have their own build systems that can be out of sync with those of their associated SDKs.
* projects that need to patch libraries with changes that, for whatever reason, will not be accepted upstream. An example for me are changes I made to GTK2 to support macOS's version of mouse events so that you can differentiate the extent of a scroll wheel "roll" correctly. My project needs this functionality, and it was never going to be part of GTK2 (the API was frozen before anyone realized that macOS handled scroll wheel events differently). So my project builds with a patched version of GTK2, not the one provided by the platform "package manager"
These sorts of real world complications are easy to want to dismiss or wave away or pretend that there's some sort of magic that will make them vanish and never come back. I don't believe that this is true.It crashed because the object was deallocated by time the handler ran. So now I'm taking a shared_ptr parameter thisref parameter to keep "this" alive. Ideally it'd be a unique_ptr, but then my understanding is that ptr->func(std::move(ptr)) is undefined
It's nice if these sorts of details are compiler errors, but at least there were some compiler errors:
I ran into some issues over whether move being ambiguous for std::move. Took awhile figuring out where to get socket types for boost, between template parameters being duck typed & boost source being a tangle to read as documentation. Errors end up being in some header when the issue is my code somewhere passing the wrong thing
Got it all sorted out eventually, but glad to get back to C/Ruby/Go/Rust programming
But then realize those horror stories were from 15+ years ago.
Did we need Rust?
Or did we need to build out the C and C++ ecosystems to make them easy and safe?
How many hours spent on all these languages for a few folks to build fiefdoms upon? Every human endeavor has a group of swindlers that tell you they’re helping but in hindsight often looks like they just got in the way.
C++ is nice and good until you hit a bug that leaks an abstraction and you realise you barely understand 10% of the language, and you'll never understand it completely, because people spend their entire careers trying to track down how language features interact and where they explode, and they're never finished.
"CppCon 2018: Nicolai Josuttis “The Nightmare of Initialization in C++” https://youtu.be/7DTlWPgX6zs
Next Halloween I will dress up as std::variant
Epochs was the only halfway practical way to attempt the ever elusive step B of the "Smaller, better C++" idea, the part where you toss away all the stuff nobody needs. For many years now, the protestation has been that it's a great idea but first a few more things must be added. And then a few more. And a few more. Bjarne himself has a laundry list. Adding things to C++ is extremely ugly but it can be done and is still being done. However removing things is hard, and Epochs proposed a practical way to begin that work. It was shot down and I think years from now a C++ post mortem will pronounce that as at least contributing to the outcome if not outright the primary cause.
Epochs would have been really hard to do in C++ 20. But it isn't getting easier and the will to attempt such a thing seems to me to be finite.
Of course it’s unlikely for you to know this because who knows all the nuances of C++ so you end up with a race in your code. Those can be very hairy to crash, reproduce, and debug.
Surely shining light on and fixing those issues would have resulted in C/C++ essentially becoming what Rust hopes to be.
But western kids needed to found new big business and institutionalize math.
Seems the west has a real issue with oligarchs needing to manage the masses. No one can be rich unless an institution has decided they are correctly rich.
Edit: I think it's in this podcast https://corecursive.com/013-rust-and-bitter-c-developers-wit...
Multithreaded programming without bugs is hard in any language, unless the language completely cripples your ability to do certain things that tend to be where the bugs can creep in.
If you religiously stick to the rules (e.g. mutexes around all variable use, mutexes and condition vars used correctly), you will not have bugs. The problems come because people do not religiously stick to the rules, because their language doesn't require them too.
The problem is that if you are forced to follow all the rules, then certain things become impossible, such as lock-free programming (even the simple single-reader, single-writer FIFO). The use of memory barriers to create provably safe lock-free code is outside the scope of regularized multithreaded programming, and since it's very very hard to get that write, but people want to try it anyway, that's where things go wrong.
Just use things the way you're supposed to and you won't have bugs with this.
If we humans just learned to use things we're supposed to, we would never have null pointer exceptions, issues with use-after-free nor buffer overflows. Heck, we should all just use goto while we're at it, all it takes is to religiously stick to the rules!
If you are doing multithreaded programming, and there's a variable shared among threads, and there's a read or write of the variable without a mutex in sight, you've done it wrong.
Yes, the mutex owner could be a caller several layers up the stack. Sometimes that's a legitimate design, and if you know what you're doing your function/method names will reflect the fact that the lock is already held. If you don't know what you're doing, you should avoid that design and lock the mutex in the same scope as the read/write.
And of course, using RAII with C++ (or anything else that supports it) makes this sort of thing easy to do.
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
If you are starting a project from scratch with C++, you can avoid a lot of the pitfalls chrome's team has. Additionally Google has an arguably poor C++ coding style that is also completely out of date.
A company that uses C++ more effectively is arguably Adobe, who has the great Sean Parent.
Any non-trivial code base in any language will have security issues, but the argument that these security vulnerabilities are a result of using C++ poorly doesn't change the fact that C and C++ have tons of footguns and pitfalls based on both modern and legacy code.
https://www.cvedetails.com/vulnerability-list/vendor_id-53/p...
or Adobe as in Photoshop?
https://www.cvedetails.com/vulnerability-list/vendor_id-53/p...
Also, construction, destruction and move semantics makes everything really complicated and even simple baseline code requires a bunch of boilerplate [2].
1: https://www.boost.org/doc/libs/develop/libs/nowide/doc/html/...
2: https://gist.github.com/EmmanuelOga/12e1da5aedd9f6dc50e742cd...
Rust does much more to force you to be safe. (Or, to put it differently, C++ still has all the unsafe ways available, and not locked away behind the "unsafe" keyword.)
unsafe mainly allows you to dereference pointers. References are guaranteed to be safe at all time, with an associated lifetime, while pointers can hold any possible memory address, valid or not (like in C++).
unsafe also let you promote a pointer to a reference by assigning a lifetime.
And finally, unsafe allows you to call functions themselves marked unsafe. One notable function is called transmute, and is very similar to how the the C style cast works in C++. It's the one that automatically selects between static_cast and reinterpret_cast depending on the context.
If so, the C++ committee wasn't interested in doing so. Preferring instead to say that new features don't have safety if there was any possibility that doing so might provide opportunity for improved performance.
Don't worry, when inevitably you blow your feet off with any of the new footguns provided, they'll be happy to tell you that it's your fault, a true C++ programmer would have known not to do that. "Git gud" as the gamers say.
Backward compatibility is valuable, but so is letting go of old habits. With C++ and Rust, we can have our cake and eat it too. Plus, arguments about which language is better! ;)
I've worked as a developer for about 35 years and I have yet to work on a C++ project where there isn't older code that has to be accommodated.
Being able to write code that doesn't crash after a while isn't really a high bar.
Totally agree.
>"it quickly gets ugly because you have to deal with legacy code that wasn't written in modern C++"
I do not work with the projects (I assume monoliths) of such size so I guess I can count myself lucky. I would guess though that this amount of code accumulates over many years and I suspect that the majority of languages along with libs and other accompanying stuff would change as well over the time. Maybe C++ is not so special in this regard.
I was hired once to fix old PHP application which was insanely giant. The type of code I saw there ranged from beautiful to making me nearly puke. It looks like the situation similar to what you've described but in completely different language. Again the cause here I think is total size, many developers coming and going and their qualifications.
Also for as long as I can remember (40 years) I've almost exclusively worked on creating new products from scratch. Again extremely lucky. For new projects I would definitely advocate C++. But if one wants to do it in Rust / (insert your own favorite) for example I have nothing against it. Seems like a matter of taste to me (assuming compile times are reasonable and do not impede workflow).
I would admit that I would never dare to write / mess with some code I see in system libraries or some other template heavy libraries. It can be extremely complex language wise. But I've already mentioned it in original post. Do not try to be Alexandrescu. Those are special people. And this is also special purpose type of code that is not needed for general application programming.
This is is bad in every language as it often means you get code that was written for a different version of the language. But for C++ it is particularly bad because C++ has spent so many years not even getting the most basic things right.
And when I say basics, I mean things like a string type that people will consistently use.
This reminded me of the very first industry conference I attended as a kid, Usenix C++ 1992, from where I seemed to recall a talk about Mentor dealing with static initializer costs. :)
https://archive.org/details/1992-proceedings-c-portland/page...
I remembered that paper about a decade later, when a related problem came up in an interview at a company developing a new Web-oriented programming language, when they were talking technical about how they do program loading. It turned out they had indeed anticipated and/or run into that, and had a clever solution for it, and seemed impressed that I'd asked about it (thanks to the Usenix C++ paper by John F. Reiser from Mentor Graphics).
Stuff like const correctness and references were way ahead of its time IMHO, and I always found his talks and writing insightful.
Despite the pretty insane success of his creation, and all the hate, he always seemed pretty down to earth and friendly to me - I don't know if a lot of people could have pulled that off in his position.
Maybe I'm missing some major flame wars or dramas, but from all I've seen and heard, a very inspiring person.
Bjarne Stroustrup: “I Did It for You All [Your Salaries] ” - https://news.ycombinator.com/item?id=29236906 - Nov 2021 (3 comments)
Bjarne Stroustrup: “I did it for you all” (1998) - https://news.ycombinator.com/item?id=8410868 - Oct 2014 (3 comments)
Was the first thing I ctrl+f'd for, the second being 'satire' and here we are. Hi! :)
Why would anyone say that about a language they designed?
Crazy how I used to agree with everything these people (and the suckless.org folks) said and now I'd strictly avoid working with anyone like that.
SQL database as harmful? Wtf. Vim is harmful? Like, they should just fking quit CS if they are afraid of complexity - because due to many interesting problems having an essential complexity way higher than the very low bar they can understand, they can’t really produce anything worthwhile.
It is a bit dated by now, but it is the best book on the design and evolution of any programming language in general I have come across. (wink If anyone knows of a serious contender, please let me know!) I wish he'd update it to reflect the changes C++ has seen since the book was first published.
I remember Stanley B. Lippman (one of the first developers on cfront) recollecting how the proposal to implement multiple inheritance was met with resistance from the community. And the implementing team realized they couldn't write a sane implementation, and people complained against it, but they made one anyway, partially because they wanted to prove they could. New features to cfront were added with very little concern for design.
Things where standardization would have mattered (like the mangling algorithm) were never touched, so now every compiler has the liberty to generate whatever symbols it wants, and call functions with whatever calling convention it chooses, so you either have to compile all your dependencies, or make sure you fetch the binaries that use the exact same compiler version and flags, otherwise they won't link.
Also, Stroustrup didn't "soldier on", the CPP standard is maintained by a committee of people from all over the world, and the standard library slowly adopts data types and algorithms from the boost library, because they need a multi-year staging period, handled by someone else, to see if things work before they muster the courage to standardize it.
Besides the main reason why C++ exists is because he swore to himself never to go through the Simula => BCPL downgrade ever again, and C is a tiny step up from Bootstraping CPL compiler, so....
Another factor was purely irrational. Nobody seemed to doubt that I could implement templates efficiently. Multiple inheritance, on the other hand, was widely supposed to be very difficult to implement efficiently. For example, in summary of C++ in his book on Objective C, Brad Cox actually claimed that adding multiple inheritance to C++ was impossible. Thus, multiple inheritance seemed more of a challenge.
He then goes on a 13 page explanation of how he thought there was a simple implementation.He then acknowledges the controversy, but brushes it aside with:
I think - as I did then - that the fundamental flaw in these arguments is that they take multiple inheritance far too seriously. Multiple inheritance doesn't solve all your problems, but it doesn't need to because it's quite cheap. Sometimes multiple inheritance is very convenient to have.
I have kept out of the multiple inheritance debates: multiple inheritance is in C++ and cannot be taken out or radically changed; I personally find multiple inheritance useful at times; some people insist that multiple inheritance is essential to their approach to design and implementation; it is still to early to have solid data and experience about the value of C++ multiple inheritance in large scale use; and, finally, I don't like to spend my time on sterile discussions.
This goes hand in hand with the original "principles" of C++ design, namely "C++ must be useful now". It didn't really matter how the complexity will evolve in the future, as long as it solved someone's problem today. And once it was implemented, there was no going back, so it didn't matter what people thought, it was done.This process isn't really what I would call "design".
These are examples of doing more with less and avoiding unnecessary complexity by thinking ahead. Ironically, they probably wouldn't be designed the way they are if it wasn't for the hindsight provided by C++
They don't have to be "perfectly" designed, the design needs to exist. If Go didn't have a design, it would've had a half assed generics implementation, like C++ has multiple inheritance. It's precisely because generics are hard to implement right and the design constrains how much you can stretch the language that Go still doesn't have them. And it's arguably a good thing.
Sorry I wasn't explicit: it's safer and easier to write the same application in Go or Zig than it is in C++, even without generics or read-after-write compile-time checks.
Go generics are half assed, compromised to fit into existing codebases, as it was expected they would turn out.
Are you also going to argue for the beautiful design of nullable interfaces that aren't actually null?
Maybe it was the clever design idea that one has to produce a compiler error to validate if a given type does support or not a specific interface.
I know, modules, what a beautiful design, where the community feedback was greatly appreciated, what a lovely design it turned out to be.
I asserted CFront was a mess of ad-hoc features implemented in a rush prioritized by personal hubris. I asserted Bjarne didn't consider how much complexity was piling up and didn't listen to critics. I've provided you with quotes from his own book supporting this.
Your every reply was condescending whataboutism, my friend. Can you provide counter arguments why CFront was a beautifully thoughtfully designed language where features and complexity was considered and debated before being implemented? Because all your other arguments are just strawmen.
And I would really appreciate it if you could use a language that at least tries to use a constructive tone that adds value to the debate, instead of the snarky sarcasm one-liners. I don't care much for this white horse, Bjarne defending attitude.
Bjarne's a genuinely good guy, and very smart; I think the "interview" is fun, but it doesn't really sound anything like him.
James Gosling designed Java to fix C++, and Anders Hejlsberg designed C# to fix Java, and he also designed TypeScript to fix JavaScript.
https://news.ycombinator.com/item?id=22210073
From the HN discussion about the video of "A Conversation with Language Creators: Guido, James, Anders and Larry"
https://news.ycombinator.com/item?id=19568378
https://www.youtube.com/watch?v=csL8DLXGNlU
I posted these Anders Hejlsberg quotes, who co-designed TypeScript, C#, Delphi, Turbo Pascal, etc:
https://news.ycombinator.com/item?id=19568378
>"My favorite is always the billion dollar mistake of having null in the language. And since JavaScript has both null and undefined, it's the two billion dollar mistake." -Anders Hejlsberg
>"It is by far the most problematic part of language design. And it's a single value that -- ha ha ha ha -- that if only that wasn't there, imagine all the problems we wouldn't have, right? If type systems were designed that way. And some type systems are, and some type systems are getting there, but boy, trying to retrofit that on top of a type system that has null in the first place is quite an undertaking." -Anders Hejlsberg
>Andrew Hejlsberg:
>Maybe I'll just add, with language design, you know one of the things that's interesting, you look at all of us old geezers sitting up here, and we're proof positive that languages move slowly.
>A lot of people make the mistake of thinking that languages move at the same speed as hardware or all of the other technologies that we live with.
>But languages are much more like math and much more like the human brain, and they all have evolved slowly. And we're still programming in languages that were invented 50 years ago. All the the principles of functional programming were though of more than 50 years ago.
>I do think one of the things that is luckily happening is that, like as Larry says, everyone's borrowing from everyone, languages are becoming more multi-paradigm.
>I think it's wrong to talk about "Oh, I only like object oriented programming languages, or I only like imperative programming, or functional programming".
>It's important to look at where is the research, and where is the new thinking, and where are new paradigms that are interesting, and then try to incorporate them, but do so tastefully in a sense, and work them into whatever is there already.
>And I think we're all learning a lot from functional programming languages these days. I certainly feel like I am. Because a lot of interesting research has happened there. But functional programming is imperfect. And no one writes pure functional programs. I mean, because they don't exist.
>It's all about how can you tastefully sneak in mutation in ways that you can better reason about. As opposed to mutation and free threading for everyone. And that's like just a recipe for disaster.
And these Larry Wall and James Gosling and Guido van Rossum quotes:
>James Gosling wants to punch the "Real Men Use VI" people. "I think IDEs make language developers lazy." -Larry Wall
>"IDEs let me get a lot more done a lot faster. I mean I'm not -- I -- I -- I -- I -- I'm really not into proving my manhood. I'm into getting things done." -James Gosling
>"In the Java universe, pretty much everybody is really disciplined. It's kind of like mountain climbing. You don't dare get sloppy with your gear when you're mountain climbing, because it has a clear price." -James Gosling
>"I have a feature that I am sort of jealous of because it's appearing in more and more other languages: pattern matching. And I cannot come up with the right keyword, because all the interesting keywords are already very popular method names for other forms of pattern matching." -Guido van Rossum
Also:
https://news.ycombinator.com/item?id=19568860
DonHopkins 10 months ago [-]
>Anders Hejlsberg also made the point that types are documentation. Programming language design is user interface design because programmers are programming language users.
>"East Coast" MacLisp tended to solve problems at a linguistic level that you could hack with text editors like Emacs, while "West Cost" Interlisp-D tended to solve the same problems with tooling like WYSIWYG DWIM IDEs.
>But if you start with a well designed linguistically sound language (Perl, PHP and C++ need not apply), then your IDE doesn't need to waste so much of its energy and complexity and coherence on papering over problems and making up for the deficiencies of the programming language design. (Like debugging mish-mashes of C++ templates and macros in header files!)
Incidentally, back then I had to write device drivers in C++ - templates, inheritance and all. To preserve my sanity, I wrote a Perl script which converted a simple text file describing device registers into the horrible C++ code sausages.
I have a feeling we're not in emerald city anymore by Henry G. Baker, https://dl.acm.org/doi/10.1145/254459.254465
I've been looking for a few minutes for a public copy or transcription, because I doubt I read it in ACM's digital library (though I may have when I was in college). I wonder how much it may have influenced this Stroustrup "interview".
What are the others?