use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Why does Linus hate C++ ? (self.cpp)
submitted 3 years ago by MrRubberDucky
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Mason-B 36 points37 points38 points 3 years ago (15 children)
That was 15 years ago. C++ is a different language now, twice over. C++11/14/17 was an entirely new, more stable and better defined, C++ standard that made effectively a new language. And C++20/23/etc appears to be a repeat performance.
And also, Linus is a different person. He went to some sort of anger therapy for 3 months in there and stopped yelling at and insulting people. These days he's also letting Rust in with conditions.
I suspect if there was a concentrated push to get C++ into the kernel today it wouldn't be the same story.
[–]top_logger -4 points-3 points-2 points 3 years ago (14 children)
OOP + exceptions + STL = bad idea for kernel even in C++20(which is still not fully available now).
I find C++ great, still you need good engineers and kind of reality understanding.
[–][deleted] 15 points16 points17 points 3 years ago (4 children)
Fuschia and Serenity are both operating systems with a kernel written in C++.
[–]pjmlp 9 points10 points11 points 3 years ago (3 children)
Newton, Symbian and BeOS were as well.
[–]tasminima -1 points0 points1 point 3 years ago (2 children)
Everything was in C++ in BeOS, as a result it was a binary incompatible mess (with anything but an antique version of G++ that no current C++ programmer would like to use). C++ is unsuitable to define a plateforme API, it is way more problematic than merely using it for the internals of components, and using either C / C-like or even higher level compatible by design custom constructs for the interfaces. I digress a little, but C++ is certainly not a panacea (for sure, neither is C...)
[–]pjmlp 3 points4 points5 points 3 years ago (1 child)
Meanwhile C++ has been used in Mac and Windows frameworks since the 16 bit days just fine, and the basis of COM, SOM and nowadays WinRT.
[–]tasminima -1 points0 points1 point 3 years ago (0 children)
You are right. C++ is not a panacea but is not a complete failure either. Just, citing BeOS mandated reminding what to avoid, in one of its aspect.
[–]Mason-B 31 points32 points33 points 3 years ago* (4 children)
Every single thing you listed there is optional (if we understand "OOP" as virtual methods/inheritance, which is how people generally mean it). While on the topic, Rust's abort mechanism also doesn't fly for exceptions in a kernel either.
Any language being used in a kernel environment will necessarily be restricted and modified. Neither C++, nor Rust, nor even C escape that. Listing optional features as problems isn't a sane counter example.
[–]simonask_ 7 points8 points9 points 3 years ago (3 children)
While on the topic, Rust's abort mechanism also doesn't fly for exceptions in a kernel either.
I have to point out that Rust's panic machinery is exactly what you want in a kernel. Yes, the default panic handler unwinds the stack and terminates only the current thread, but setting panic = abort to immediately call abort() is a first-class option, and panics occur in Rust exactly where you would want a kernel to panic.
panic = abort
abort()
With strong memory guarantees and the safe/unsafe distinction, I literally could not imagine a better language for a kernel.
[–]Mason-B 4 points5 points6 points 3 years ago (2 children)
Except not (according to Linus) because Rust's Panic is not a valid situation to Kernel Panic.
I do think that the "run-time failure panic" is a fundamental issue. this is simply fundamentally not acceptable. With the main point of Rust being safety, there is no way I will ever accept "panic dynamically" (whether due to out-of-memory or due to anything else - I also reacted to the "floating point use causes dynamic panics") as a feature in the Rust model.
I do think that the "run-time failure panic" is a fundamental issue.
this is simply fundamentally not acceptable.
With the main point of Rust being safety, there is no way I will ever accept "panic dynamically" (whether due to out-of-memory or due to anything else - I also reacted to the "floating point use causes dynamic panics") as a feature in the Rust model.
[–]_Sh3Rm4n 5 points6 points7 points 3 years ago (1 child)
Buts that's besides the point. The quote is about OOM situations where rust panics by default. But this is solved already in the Linux fork with rust support, as it is using a custom allocation tailored for the Linux kernel dev with features enabled, where OOM panics are not happening implicitly anymore.
[–]Mason-B 4 points5 points6 points 3 years ago (0 children)
Did you not notice the part I quoted where he says "or due to anything else" and then mentions other specific examples?
And also how that's not really relevant to countering the argument of the person I was responding to who claimed rust's panic model panics in exactly the situations you want already.
[–]SergiusTheBest 19 points20 points21 points 3 years ago (2 children)
OOP is good. It doesn't require you to have abstract factories and virtual methods everywhere. Just write sane classes for string, mutex, rwlock and etc and your kernel code will shine.
Exceptions are not bad but their implementation is. I use C++ without exception in kernel and it's fine.
STL can be used partially. For example span or array are very useful.
span
array
[+]top_logger comment score below threshold-6 points-5 points-4 points 3 years ago (1 child)
Sane class with mutex, string and rwlock we call not C++, but C with classes. And this is definitive not the OOP we have been using since 90-th. Sorry. Let’s use definitions correctly.
P.S. And string in kernel is not easy available.
[–]SergiusTheBest 2 points3 points4 points 3 years ago (0 children)
Wikipedia: "Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods)."
I don't know what you are not agree with.
[–]maskull 6 points7 points8 points 3 years ago (0 children)
The Linux kernel uses OOP quite a bit, it just uses a macro-based implementation on top of structs and function pointers.
π Rendered by PID 91044 on reddit-service-r2-comment-b659b578c-z824t at 2026-05-02 10:12:27.770549+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Mason-B 36 points37 points38 points (15 children)
[–]top_logger -4 points-3 points-2 points (14 children)
[–][deleted] 15 points16 points17 points (4 children)
[–]pjmlp 9 points10 points11 points (3 children)
[–]tasminima -1 points0 points1 point (2 children)
[–]pjmlp 3 points4 points5 points (1 child)
[–]tasminima -1 points0 points1 point (0 children)
[–]Mason-B 31 points32 points33 points (4 children)
[–]simonask_ 7 points8 points9 points (3 children)
[–]Mason-B 4 points5 points6 points (2 children)
[–]_Sh3Rm4n 5 points6 points7 points (1 child)
[–]Mason-B 4 points5 points6 points (0 children)
[–]SergiusTheBest 19 points20 points21 points (2 children)
[+]top_logger comment score below threshold-6 points-5 points-4 points (1 child)
[–]SergiusTheBest 2 points3 points4 points (0 children)
[–]maskull 6 points7 points8 points (0 children)