Why ! C++

L

lakshmi

Hi all,
We mostly use C for system programming.
Why not C++?
Since c++ is superset of C.
we can combine both if needed...
do we have any file system written in C++.
Thx.
 
S

Sarath

Hi all,
We mostly use C for system programming.
Why not C++?
Since c++ is superset of C.
we can combine both if needed...
do we have any file system written in C++.
Thx.

Why we can't develop a file system in C++. I think it is possible even
if I dint implement the same.
C++ really comes in the commercial software industry which need more
flexibilty, re-usability, data security and the power of C++ is really
superb. I too was a supporter of C when I was studying. But when I
started working, i realized that it is possible to express real world
problems using C++ pretty well in manner. It also has a powerful
standard library and also supports generic programming. It solely
depends on the system, complexity, performance and many other factors
decides to choose between programming languages.
 
I

Ivan Vecerina

: Hi all,
: We mostly use C for system programming.
: Why not C++?
Mainly historical reasons. It is easier to find a C expert
than a C++ expert in this application domain.

: Since c++ is superset of C.
well... mostly.

: we can combine both if needed...
: do we have any file system written in C++.
The Haiku-OS (an open source reimplementation of BeOS)
has re-implemented the complete file system in C++:
http://haiku-os.org/

hth -Ivan
 
R

Roland Pibinger

We mostly use C for system programming.
Why not C++?

Because C is the only portable system programming language available?
C++ is not appropriate for system programming.
Since c++ is superset of C.
we can combine both if needed...

That was the original idea of the C++ inventor. Do piecemeal injection
of C++ into C code until C becomes extinct. It didn't work.
do we have any file system written in C++.

Why would you want to have one?

Best wishes,
Roland Pibinger
 
L

lakshmi

Because C is the only portable system programming language available?
C++ is not appropriate for system programming.


That was the original idea of the C++ inventor. Do piecemeal injection
of C++ into C code until C becomes extinct. It didn't work.


Why would you want to have one?

Best wishes,
Roland Pibinger

yes..i would like to do that....
you think a file system in c++ will be as successful like the one
written in C?
 
M

mlimber

Because C is the only portable system programming language available?

C is certainly more portable because it is more simplistic and because
compiler/library vendors have not kept up with the C++ Standard in
short order. Then again, when you're doing systems programming, it's
often platform-specific and not something you port elsewhere. What one
should favor in a language for systems programming is power and speed,
not portability, and C++ does quite well on those compared to C.
C++ is not appropriate for system programming.

That's not what the Creator says:

http://www.research.att.com/~bs/bs_faq.html#whyC

Cheers! --M
 
L

Lionel B

Because C is the only portable system programming language available?
C++ is not appropriate for system programming.


That was the original idea of the C++ inventor. Do piecemeal injection
of C++ into C code until C becomes extinct. It didn't work.

Please don't feed the troll.
 
D

dervaish

Hi all,
We mostly use C for system programming.
Why not C++?
You can use C++ also but C++ has many other design issue like OOP
through which you can understand the power of C++ language. Other
being the historic reason as many lines of code(may be millions) is
written in C, so if you want to add something to it, then C is
preferred. Also some basic code structure for system programming is
already written in C, so just have to copy it and then proceed to
specialized part of your system's program.
Since c++ is superset of C.
we can combine both if needed...
But don't ever do that as then code maintaining ability would be at
lost. May be for 1000 lines code it would not show but once code is
expanded, you might have several serious problem and it is always
better to one programming language and focus on its issue if one
really wants to exploit the features of programming language.
 
Z

Zara

Hi all,
We mostly use C for system programming.
Why not C++?
Since c++ is superset of C.
we can combine both if needed...
do we have any file system written in C++.

There are some systems written in C++. I am working on an embeddded
one that is comprised of a couple of thousand lines of C++ plus a
hundred lines of assembler, plus 0 (zero) lines of C.

Zara
 
S

SasQ

Dnia Mon, 05 Mar 2007 08:15:19 +0100, Zara napisa³(a):
There are some systems written in C++. I am working on
an embeddded one that is comprised of a couple of
thousand lines of C++ plus a hundred lines of assembler,
plus 0 (zero) lines of C.

How did you make it?
How can C++ work in an embedded system?
I thaught C++ needs some additional implementation code,
which make base for C++ language facilities before it
call main() function. I mean the things like reserving
static memory, calling constructors for static objects,
exception handling mechanisms etc. And I thaught that
new and delete operators have to be implemented using
some system API/kernel calls to some system memory
manager, and cannot work in "blank" environment without
some system/kernel, which may do the memory management
for new/delete implementation code.
So how it's been done? I'm very curious about that,
because the plain old C doesn't need any runtime
support AFAIK.
 
M

Michael DOUBEZ

SasQ a écrit :
Dnia Mon, 05 Mar 2007 08:15:19 +0100, Zara napisa³(a):


How did you make it?
How can C++ work in an embedded system?
I thaught C++ needs some additional implementation code,
which make base for C++ language facilities before it
call main() function.
A lot of thing happens before main and even before static initialisation.
You have to inititialize your processor, your stack (if you have one)
and other stuff (like disabling this damned watchdog if you have a long
boot time).
I mean the things like reserving static memory,
This is just a matter of knowing where to put it in the memory area.
calling constructors for static objects,
nothing magic in that, in the same way you initialize object with raw
memory: new(memory_ptr) object();.
But in fact this stage is handled by the compiler.
exception handling mechanisms etc.
This is a compiler question.
And I thaught that
new and delete operators have to be implemented using
some system API/kernel calls to some system memory
manager, and cannot work in "blank" environment without
some system/kernel, which may do the memory management
for new/delete implementation code.

The same way you would do it in C though C++ has a mixed position about
dynamic allocation, you cannot redefine completly new and delete (thanks
godness).

"C programmers think memory management is too important to be left to
the computer. Lisp programmers think memory management is too important
to be left to the user."

(from Ellis and Stroustrup's The Annotated C++ Reference Manual)

So how it's been done? I'm very curious about that,
because the plain old C doesn't need any runtime
support AFAIK.

You mean it doesn't provide a way to call code before main ?

Michael
 
Z

Zara

Dnia Mon, 05 Mar 2007 08:15:19 +0100, Zara napisa?(a):


How did you make it?
How can C++ work in an embedded system?
I thaught C++ needs some additional implementation code,
which make base for C++ language facilities before it
call main() function. I mean the things like reserving
static memory,
It is handled by the compiler
calling constructors for static objects,
exception handling mechanisms
Oh , sorry. I turned off exceptions. This is the only point I escape
from Std C++
etc. And I thaught that
new and delete operators have to be implemented using
some system API/kernel calls to some system memory
manager,
I wrote it myself, using C++. Not so difficult
and cannot work in "blank" environment without
some system/kernel, which may do the memory management
for new/delete implementation code.
See above
So how it's been done? I'm very curious about that,
because the plain old C doesn't need any runtime
support AFAIK.
What about malloc/reee/realloc? But you may also write them yourself.

Regards,

Zara
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top