Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:18:00+00:00 2026-06-10T06:18:00+00:00

The question is NOT about the Linux kernel. It is NOT a C vs.

  • 0

The question is NOT about the Linux kernel. It is NOT a C vs. C++ debate either.

I did a research and it seems to me that C++ lacks tool support when it comes to exception handling and memory allocation for embedded systems:

Why is the linux kernel not implemented in C++?
Beside the accepted answer see also Ben Collins’ answer.

Linus Torvalds on C++:

“[…] anybody who designs his kernel modules for C++ is […]
(b) a C++ bigot that can’t see what he is writing is really just C anyway”

” – the whole C++ exception handling thing is fundamentally broken. It’s especially broken for kernels.
– any compiler or language that likes to hide things like memory allocations behind your back just isn’t a good choice for a kernel.”

JOINT STRIKE FIGHTER AIR VEHICLE C++ CODING STANDARDS:

“AV Rule 208 C++ exceptions shall not be used”


  1. Are the exception handling and the memory allocation the only points where C++ apparently lacks tool support (in this context)?

  2. To fix the exception handling issue, one has to provide bound on the time till the exception is caught after it is thrown?

  3. Could you please explain me why the memory allocation is an issue? How can one overcome this issue, what has to be done?

As I see this, in both cases one has to provide an upper bound at compile time on something nontrivial that happens and depends on things at run-time.


Answer:

  1. No, dynamic casts were also an issue but it has been solved.

  2. Basically yes. The time needed to handle exceptions has to be bounded by analyzing all the throw paths.

  3. See solution on slides “How to live without new” in Embedded systems programming. In short: pre-allocate (global objects, stacks, pools).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:18:01+00:00Added an answer on June 10, 2026 at 6:18 am

    Well, there are a couple of things. First, you have to remember that the STL is completely built on OS routines, the C standard library, and dynamic allocation. When your writing a kernel, there is no dynamic memory allocation for you (you’re providing it) there is no C standard library (you have to provide one built on top of your kernel), and you are providing system calls. Then there is the fact that C interops very well and easily with assembly, whereas C++ is very difficult to interface with assembly because the ABI isn’t necessarily constant, nor are names. Because of name mangling, you get a whole new level of complication.

    Then, you have to remember that when you are building an OS, you need to know and control every aspect of the memory used by the kernel. In C++, there are quite a few hidden structures that you have no control over (vtables, RTTI, exceptions) that would severely interfere with your work.

    In other words, what Linus is saying is that with C, you can easily understand the assembly being generated and it is simple enough to run directly on the machine. Although C++ can, you will always have to set up quite a bit of context and still do some C to interface the assembly and C. Another reason is that in systems programing, you need to know exactly how methods are being called. C has the very well documented C calling conventions, but in C++ you have this to deal with, name mangling, etc.

    In short, it’s because C++ does things without you asking.

    Per @Josh’s comment bellow, another thing C++ does behind your back is constructors and destructors. They add overhead to enter and exiting stack frames, and most of all, make assembly interop even harder, as when you destroy a C++ stack frame, you have to call the destructor of every object in it. This gets ugly quickly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some question about linux-kernel, let's assume that I have two threads in
(note that this question is not about CAS, it's about the May fail spuriously
This question is not about caching. I need this in-memory table for many small
My question is not about how to solve this error(I already solved it) but
This question is not about which is the best, it is about which makes
This question is not about 'best' barcode library recommendation, we use various products on
My question is not about a specific code snippet but more general, so please
For starters, this question is not so much about programming in the NetBeans IDE
This is not a question about a specific framework. I am using plain php
This is not a question about jQuery, but about how jQuery implements such a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.