Firstly, this blog post is so similar in its tone and wording that I suspect it's an AI-generated transcription of the video for the most part.
If my goal were to confuse beginners as much as possible, I'd name things exactly the way the STL does. The most commonly used container is called vector, even though it's really a dynamic array. In the usual sense, a vector is a quantity with a direction. Even Alexander Stepanov, the creator of the STL, later admitted the name was a mistake.
Isn't this word-for-word what the video says?!
EDIT: Well no, I've checked, and the article just has a similar tone and presents the content of the video without commentary. The original video also points out that Alexander Stepanov considers the naming of vector to be a mistake, and the article copies and pastes that claim without commentary and without adding a citation. So it seems more like parroting than literally transcribing.
Also, the point of the video is obviously to show C++ in the most negative possible light for entertainment. It could have been a really fair criticism because there are some good points in it, but I guess it just wouldn't get people's attention so much if made in good faith.
For example, the video makes the claim that Java casting is simple because you can just write (int), but in C++, it's super complicated and you have all these distinct casts. It's not even mentioned that C++ and Java literally have the exact same cast syntax, and that (int) in C++ is the "dumb and simple cast syntax for everything" that Java has. That is if you want to use C-style casts, which people often don't, for valid technical reasons, but neither the video doesn't go into those technical reasons (because it would go against the narrative that C++ is garbage, and it would be less entertaining).
To be fair i'm reading the article and it does mention the C cast, why it's a bad practice, and why was split for C++ (TLDR: So a reviewer can check if you're doing something shady, and so you can search for all specific cast because C cast where doing everything)
Which without any actual knowledge on it seems a good reason for me
Years ago Bertrand Meyer commented on the newsgroup comp.lang.c++ that c++ was an abomination. I asked him, conceding that, how did he explain that c++ was successful, but his own language eiffel was not? The ensuing discussion was interesting.
Great read, thank you! I will keep playing in garbage and love every minute of it.
IMO it has made me better at games like MTG wherea nomenclature zoo, rules, and exceptions are kind of the name of the game, and that intern does help with the coding
Mostly means zero overhead compared to if you did the same kind of thing by hand. In some cases you could optimize better due to expert domain knowledge the compiler lacks, but in general... it's about as good as it typically gets for doing that sort of thing.
Google has measured performance improvements of up to 1.6% on some large server macrobenchmarks, and a small reduction in binary sizes.
This also affects null pointer optimization
Clangโs optimizer can now figure out when a std::unique_ptr is known to contain non-null. (Actually, this has been a missed optimization all along.)
struct Foo {
~Foo();
};
std::unique_ptr<Foo> make_foo();
void do_nothing(const Foo&)
void bar() {
auto x = make_foo();
do_nothing(*x);
}
With this change, ~Foo() will be called even if make_foo returns unique_ptr<Foo>(nullptr). The compiler can now assume that x.get() cannot be null by the end of bar(), because the deference of x would be UB if it were nullptr. (This dereference would not have caused a segfault, because no load is generated for dereferencing a pointer to a reference. This can be detected with -fsanitize=null).
To be fair this page is from 2021 according to the wayback machine so the results are somewhat dated.
I don't necessarily care that it's dated, but I do care that it's missing a lot of context -- it's just saying "google measured" without saying who did the measurement, what the measurement was, what the confounding factors might've been, etc.
When Chandler Carruth first mentioned this in a presentation, the lack of any supporting benchmarks was deafening, but to be fair, he wasn't even trying to assert that this was a problem in practice. Everyone just rain with his point out of context.
I agree that more detail would be nice to better understand how the results might apply to other codebases, but I think at this point one would probably need to specifically ask the original devs for them (assuming they even remember/have access to the data).
I guess in principle libc++ makes setting up a comparison relatively simple via _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI (as long as you're willing to recompile enough of the world, I suppose ), but as far as I know no one else has felt motivated enough to try to add their own data.
20
u/sweetno Sep 04 '26
C++ is fine.*
* terms and conditions apply
20
u/eisenwave WG21 Member Sep 04 '26 edited Sep 04 '26
Firstly, this blog post is so similar in its tone and wording that I suspect it's an AI-generated transcription of the video for the most part.
Isn't this word-for-word what the video says?!
EDIT: Well no, I've checked, and the article just has a similar tone and presents the content of the video without commentary. The original video also points out that Alexander Stepanov considers the naming of
vectorto be a mistake, and the article copies and pastes that claim without commentary and without adding a citation. So it seems more like parroting than literally transcribing.Also, the point of the video is obviously to show C++ in the most negative possible light for entertainment. It could have been a really fair criticism because there are some good points in it, but I guess it just wouldn't get people's attention so much if made in good faith.
For example, the video makes the claim that Java casting is simple because you can just write
(int), but in C++, it's super complicated and you have all these distinct casts. It's not even mentioned that C++ and Java literally have the exact same cast syntax, and that(int)in C++ is the "dumb and simple cast syntax for everything" that Java has. That is if you want to use C-style casts, which people often don't, for valid technical reasons, but neither the video doesn't go into those technical reasons (because it would go against the narrative that C++ is garbage, and it would be less entertaining).29
u/sjepsa Sep 04 '26
There are two kind of languages. The ones people complain about and the ones nobody uses
6
u/rand3289 Sep 04 '26
The real problem is that using languages other than C++ is undefined behavior!
2
u/Normal-Narwhal0xFF Sep 04 '26
It's no longer abuse but first class language support! Now the compiler abuses us. But it's powerful.
2
u/Mountain-Slice-4037 Sep 05 '26
Hmm why is this static_cast alias considered incorrect in the article? I agree it may be poor practice but it looks correct?
3
u/Copel626 Sep 04 '26 edited Sep 04 '26
Great read, thank you! I will keep playing in garbage and love every minute of it.
IMO it has made me better at games like MTG wherea nomenclature zoo, rules, and exceptions are kind of the name of the game, and that intern does help with the coding
6
u/AnyPhotograph7804 Sep 04 '26
> For the past twenty years, C++ has marketed itself as the language of zero-cost abstractions, but every abstraction has a cost.
Source please, that C++ marketed itself as a zero-cost abstractions language. All i saw is, that they used the term zero-overhead but not zero-cost.
1
u/fdwr fdwr@github ๐ Sep 06 '26
For a complement of
unsigned long long int, I missunsigned short short int๐ (which I suppose would basically beuint8_t).0
u/Eric848448 Sep 04 '26
C++ used to be fun. We used to make fun of Alexandrescu and people who abused the shit out of templates.
-2
u/GoogleIsYourFrenemy Sep 04 '26
I can't complain any more about C++. Well not until the AI revolution and they no longer put up with me torturing them with C++.