Slashdot Mirror


C++ In The Linux kernel

An anonymous reader submits "A researcher at Reykjavik University Network Laboratory (netlab.ru.is) has just released a Linux patch allowing for complete kernel-level run-time support for C++ in the Linux kernel, including exceptions, dynamic type checking and global objects (with constructors and destructors) The implementation is based on the C++ ABI in GNU g++, but contains various kernel level optimizations, that reduces the cost of throwing exceptions by an order of magnitude, thus making C++ exceptions viable in several scenarios. Furthermore, the Linux module loader is extended to handle weak symbols in C++, so that dynamic type checking is reduced to a pointer comparison, in contrast to string comparison."

36 of 850 comments (clear)

  1. nice by Anonymous Coward · · Score: 5, Funny

    how long until c# is supported?

    1. Re:nice by character_assassin · · Score: 2, Funny

      If the GDI was written in C++, why isn't the API a C++ interface - or why doesn't it at least support one? That's screwy... but then again, we are talking about MICROS~1.

      --

      If you mod me down, I shall become more powerful than you can possibly imagine.
  2. More Confusion by OverlordQ · · Score: 4, Funny

    So what will we say the kernel is written in . . C? C+? CKernelRun?

    --
    Your hair look like poop, Bob! - Wanker.
    1. Re:More Confusion by M51DPS · · Score: 5, Funny

      The kernel will be written in Java for more cross-platform compatibility.

    2. Re:More Confusion by Tumbleweed · · Score: 4, Funny

      CKernelRun?

      a) CKernelCrash
      b) CKernelPatchNotGetAcceptedByLinus

      One or the other, I'm sure.

    3. Re:More Confusion by aled · · Score: 3, Funny

      that's an exception:

      throw new ExceptionPatchNotAccepted("Linus");

      --

      "I think this line is mostly filler"
    4. Re:More Confusion by frostfreek · · Score: 5, Funny

      And why not???

      With the GNU Compiler Collection able to generate machine code for Java, we'd be able to leverage all the things that Java excells at!
      Such as:



      umm....


      well,
      Oh forget it then.

    5. Re:More Confusion by freqres · · Score: 2, Funny

      But the real question is, are any of those methods better than GOSUB ?

      --
      Rampant Ninja related crimes these days...Whitehouse is not the exception
  3. C++? by Anonymous Coward · · Score: 5, Funny

    Good now I can fire up my good old visual basic and hack the kernal with COM.

    1. Re:C++? by npietraniec · · Score: 3, Funny

      and I was just thinking... I wonder how long until someone makes a "I want to use visual basic" comment. That didn't take long. hilarious.

    2. Re:C++? by FecesFlingingRhesus · · Score: 2, Funny

      No no one would ever want VB, now C# or java on the other hand.

    3. Re:C++? by Kethinov · · Score: 2, Funny
      Imagine the enormity of newbie kernel hackers if such a thing were beieved to be possible...

      I can imagine a post to usenet now...
      Subject: this damn thing wont compile

      omg why are none of my win32 api calls working this sucks this will never be better than windows
      And the ensuing reply...
      Subject: Re: this damn thing won't compile

      Uh huh. Well. It won't compile because your api calls are, uhm, frozen. Yeah. You need to unfreeze them. There should be a blue liquid in the trunk of your car called antifreeze. If you drink it all, and I do mean all of it, you'll be able to unfreeze your api calls.

      Have fun.
      --
      You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
  4. Alright!! by 21chrisp · · Score: 5, Funny


    I'm sure the kernel developers will LOVE the idea of putting C++ in the kernel.

    1. Re:Alright!! by metalogic · · Score: 5, Funny

      I see your ID isn't a coincidence.

    2. Re:Alright!! by strider44 · · Score: 2, Funny

      mmm, C++ is way too bloated - the binary code that it produces is horrible. In fact, when you think about it, not even C gives the best possible optimised code - you're wasting a whole 0.001% optimization! They should go backwards, not forwards! They should go for the best possible optimization - Assembly all the way! Just think about the extra microseconds saved - it's a linux hacker's wet dream!

  5. Stillborn. Seriously by apankrat · · Score: 3, Funny

    Java on other hand ...

    Or better yet - Brainf*ck, my personal favourite :)

    --
    3.243F6A8885A308D313
  6. Perl by Anonymous Coward · · Score: 0, Funny

    When can I submit my Perl patches to the kernal? I am waiting for that.

  7. RMS by zoeith · · Score: 5, Funny

    RMS is probably turning over in his grave... oH! wait he's not dead!

    --
    Zoeith
    1. Re:RMS by Anonymous Coward · · Score: 1, Funny
      RMS is probably turning over in his grave...

      Heh heh funny! IQ estimate: 115

      oH! wait he's not dead!

      Oh dear, revised IQ estimate: 85

    2. Re:RMS by IntergalacticWalrus · · Score: 3, Funny

      ...yet.

  8. fantastic ... by Anonymous Coward · · Score: 4, Funny

    what an incredibly awesome idea!!!

    i can't wait to try and debug virtual functions, copy constructors, and polymorphism over JTAG or BDM!!!!

    man thats gonna be fun ... my hats definitely off to this academic you have definitely spent your time wisely!!!!

    i always found C causes to much clutter in the linux kernel ... a real language will do us all good ...

    keep an eye for this in 3.0 ...

    Jim

  9. Here's what's coming up! by Le+Marteau · · Score: 3, Funny

    Support, within the kernel, for IE^H^HMozilla! It'll be perfectly safe! Trust us!

    --
    Mod down people who tell people how to mod in their sigs
  10. Re:Sorry to break it to you... by Anonymous Coward · · Score: 2, Funny

    Hello.

    My name is Linux Torvalds, and I pronounce "Linus" "Linus".

  11. great! by pyrrho · · Score: 2, Funny

    but don't use runtime type checking in the kernel please.

    or exceptions.

    --

    -pyrrho

  12. Who cares? by Anonymous Coward · · Score: 3, Funny

    My VB kernel works just fine for me.

  13. You're going to kill Stallman by TheKubrix · · Score: 2, Funny

    Or at least drive him (more?) insane!

  14. Reviving a joke... by ari_j · · Score: 2, Funny

    The good news is that we have a new renewable power source. What you do is wrap Linux in wires and place him in a magnetic casket. Putting C++ in the kernel will cause him to roll fast enough to generate enough electricity to power North America.

  15. Re:C++ by Lally+Singh · · Score: 2, Funny

    C++ wasn't standardized until 1998. Should I talk trash about C99 by referring to the original K&R version?

    --
    Care about electronic freedom? Consider donating to the EFF!
  16. Re:Who cares? by abdulla · · Score: 1, Funny

    (d) Profit!??

  17. Re:Yay! by apankrat · · Score: 2, Funny

    Assuming you are looking at integer_t type, is it primitive ?
    Made you look in header :-p

    Agreed about developers though, however the number of
    those who have a clue is drastically lower than those
    who think they have a clue. Everyone's a freaking C++
    senior these days.

    --
    3.243F6A8885A308D313
  18. Re:Yay! by Martin+Blank · · Score: 2, Funny

    C++ does fix some dumb things in C, but when it comes to shooting yourself in the foot, C++ is like an AK-47 while C is more like a .38 special.

    This should be good news to the NRA's development division...

    --
    You can never go home again... but I guess you can shop there.
  19. Re:call/cc by Dr.+Photo · · Score: 4, Funny

    Clean, but not clean enough. For true conceptual purity, you need lexical closures, call-by-name, monads, lambdas, cooperative microthreads (though of course these could be simulated by call/cc), message passing, introspection and serialization, nongenerative record types, one-shot and partial continuations, maybe a little prototype-based OOP for flavor, and of course if you add prototype-based OOP, you'll need generics that are specializable by object rather than class (as well as consider the case of whether a method specialized for a particular prototype object still applies to its descendents), not to mention considering how that would affect the implementation of a meta-object protocol and multiple inheritance.

    Once you've done all this, Linux will truly be ready for the desktop. (Assuming you axiomatize your language definition first, to get rid of unnecessary features like for loops).

  20. Re:I take exception... by Anonymous Coward · · Score: 1, Funny

    > You can use setjmp(), longjmp() with the same effect in C without the extra baggage that comes with C++ exceptions.

    You can use the S and K combinators and an "apply" operator, without having to resort to all that extra baggage that comes with "statements" and "numbers" and other needless crap like that.

  21. Re:Exceptions are suddenly viable? by shadowmatter · · Score: 3, Funny

    Even the Windows kernel developers rejected them as a bad idea.

    MS Developer #1: I was thinking we could put exceptions in the kernel.
    MS Developer #2: Are you insane? Why on earth would you want to do that? I don't think I've heard a stupider suggestion for a kernel addition.
    MS Developer #1: Really? Well uhh... how about we put an Internet browser in the kernel?
    MS Developer #2: FREAKIN BRILLIANT, let me call Bill.

    - sm

  22. wait a minute.. by tasinet · · Score: 2, Funny

    ..you mean the linux kernel isn't written in Visual Basic?

  23. Obligatory Quote by zerojoker · · Score: 2, Funny

    Object-oriented programming is an exceptionally bad idea which could only have originated in California. (Edsger Dijkstra)