kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: chambilkethakur@gmail.com (Anuz Pratap Singh Tomar)
To: kernelnewbies@lists.kernelnewbies.org
Subject: why only C?
Date: Sun, 3 Apr 2011 20:23:53 +0100	[thread overview]
Message-ID: <BANLkTimT=K8dxwnJwhn6COVwstBrzDeW0w@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikEmyURpOLS7DEvxsT6HEOPRg-ucg@mail.gmail.com>

On Sun, Apr 3, 2011 at 8:17 PM, mohit verma <mohit89mlnc@gmail.com> wrote:

> Hi list,
>
> I have a very basic question.
>
> As far as i can decipher , we impose Object oriented paradigm in kernel
> space using C  : like using gates to allow only one way entry and binding
> functions to structures in a OOP fashion  and trying to make them private to
> that structure only  , encapsulation of one struct into another structure
> (and lots of features ) and itself  lots of kernel subsystem supports like
> driver interface and blah blah behaving like **objects** .......
>
> why dont we use some fully OOPs supportive language like JAVA or partial
> supportive language like  C++ to construct Linux Kernel????
>
> I don't  think that performance is the main reason behind all this . Is
> it??
>
> Thanks a lot in advance.
>
>
Read more or even google it.
Besides its Design decision by Linus Torvalds

Here is the historic mail explaining what he said

*From: Linus Torvalds* [email blocked]
Subject: Re: Compiling C++ kernel module + Makefile
Date: Mon, 19 Jan 2004 22:46:23 -0800 (PST)


On Tue, 20 Jan 2004, Robin Rosenberg wrote:
>
> This is the "We've always used COBOL^H^H^H^H" argument.

In fact, in Linux we did try C++ once already, back in 1992.

It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.

The fact is, C++ compilers are not trustworthy. They were even worse in
1992, but some fundamental facts haven't changed:

 - 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.
 - you can write object-oriented code (useful for filesystems etc) in C,
   _without_ the crap that is C++.

In general, I'd say that anybody who designs his kernel modules for C++ is
either
 (a) looking for problems
 (b) a C++ bigot that can't see what he is writing is really just C anyway
 (c) was given an assignment in CS class to do so.

Feel free to make up (d).

		Linus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110403/43283431/attachment.html 

  reply	other threads:[~2011-04-03 19:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-03 19:17 why only C? mohit verma
2011-04-03 19:23 ` Anuz Pratap Singh Tomar [this message]
2011-04-03 19:25 ` Daniel Baluta
2011-04-03 19:49 ` Bernd Petrovitsch
2011-04-04  0:30   ` Chaitannya Mahatme
2011-04-04  9:58     ` Bernd Petrovitsch
2011-04-04  9:04   ` mohit verma
2011-04-06 17:37 ` StephanT
2011-04-06 19:30   ` mohit verma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTimT=K8dxwnJwhn6COVwstBrzDeW0w@mail.gmail.com' \
    --to=chambilkethakur@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).