After discussing a lot, i gathered some important points given by our
friends... Below are some points, why we use C rather than C++...
When doing kernels, you'll likely be interfacing with lots of low-level
functions to handle hardware interrupts and C is the most portable
language (across different compilers) for doing this.
High-level authoring systems allow developers to implement
sophisticated software products quickly. Such systems have many
advantages, therefore, in projects where there is a premium on
productivity. However, these advantages are won at some cost: high
level programs operate less directly on the hardware they control than
low level programs.
The best high level authoring tools can, of course, be extended at low
level to serve particular needs (eg with the aid of compiled languages
like C). It is important, therefore, when setting up a project team, to
consider the merits of adding low level programming skills to the team
even though much of the development will be at a higher level. The
presence of in house skills of this kind can be extremely
cost-effective.
Low-level languages are closer to the hardware than are high-level
programming languages, which are closer to human languages.
When choosing a programming language to make a project, many different
considerations can be taken. First, one must decide what is known as
the level of the programming language. The level determines how near to
the hardware the programming language is. In the lower level languages,
instructions are written thinking directly on interfacing with
hardware, while in "high level" ones a more abstract or conceptual code
is written.
Generally, high level code is more portable, that means it can work in
more different machines with a smaller number of modifications, whereas
a low level language is limited by the peculiarides of the hardware
which it was written for. Nevertheless, the advantage of low level code
is that it is usually faster due to the fact that it is indeed written
taking advantage of the possibilities of a specific machine.
A higher or lower level of programming is to be chosen for a specific
project depending on the type of program that is being developed. For
example, when a hardware driver is developed for an operating system
obviously a very low level is used for programming. While when big
applications are developed usually a higher level is chosen, or a
combination of critic parts written in low level languages and others
in higher ones.
(So from the above statement its clear that Object Oriented Programming
is generally used for application type of projects)
When i searched for why the systems like Unix, Linux, Windows have been
written in C, i came up with an answer that its just because C was
considered as a 'portable assembler', allowing to drive the hardware on
one hand, and to provide a sufficient level of abstraction to build
portable interfaces (API).
Some minor reasons for using C from
http://www.linuxdevices.com/eljonline/issue07/4870s1.html
*
C++'s virtues are expensive. Advanced OOP features, such as
templates and the practice of using classes in the place of primitives,
to name two examples, cause unacceptable code bloat.
*
A C++ compiler may generate many routines for one function
(templates) or create routines where no function explicitly appeared
(constructors, casts, etc.). There is generally a one-to-one
relationship between a function in C code and the resulting
machine-code routine. It's easier to optimize what you can see than
what you must infer.
*
Virtual methods and polymorphism complicate runtime linking and
require many relocations. This slows C++ application launch time
considerably. C applications are both simple to link and amenable to
lazy linking, so they load quickly. (For details, see Waldo Bastian's
paper ``Making C++ Ready for the Desktop",
http://www.suse.de/~bastian/Export/linking.txt.)
*
Each class with virtual methods has an associated vtable array,
which adds memory overhead.
*
C++'s tighter type-checking makes it difficult to write the
space-conscious code reuse common to C applications (think: void *).
*
The small, simple code demanded of embedded projects provides
maintainability. There is no reason to assume OOP will further simplify
such systems.
*
GUIs may not have a simple solution in a rigorous OOP model.
*
It's easy to get carried away and start doing OOP for OOP's sake.
The One True Object Model may describe a problem perfectly, but it
comes at the cost of excessive code.
Carefully written C code can be much faster than C++ code,
especially on embedded hardware. GTK+'s hand-crafted object system
offers much better spatial locality than C++'s more numerous and
distributed constructors. Our device has a tiny cache, so locality is
an especially important performance consideration.
From the above said points, I feel that 'C' Code is more close to
kernel and harware programs where memory management, speed are
considered and where as 'C++' Code is for easy use for programmers in
developing Application level programming...