Re: Can C++ be used for system programming such as OS & DB?
Maybe it's a stupid question, but I really couldn't figure it out. C++
is expected to be a better C, provides compatibility with C, and is
able to do all that C can do. however, the number of projects in
sf.net written by C++ is always smaller than that of C, many people
directly turn to Java or C# after they learned C. Now that C++ is a
system programming language, it should have the capability to replace
C in many cases.
We all know that the most important Operating Systems
are all written by C (the core part), and in my memory the DB engine
of Oracle is written by C (what about DB2 & sybase?). Why not use C++
to program these projects, since the management of C++ projects is
An operating system is /not/ written in a single language. There's some
assembler at the innermost portions, some C, some C++ (large portions of
Windows are apparently written in C++), and even script languages. C++
has too much baggage for some parts of an operating system (mainly the
parts written in assembler), and it's too low-level for other parts
(such as those written in scripting languages), and fits quite well for
many parts in between.
And another question. What about the runtime efficiency of C++
compared to that of C? because of the added OO features, C++ may be a
little slower. but if use C to simulate and implement the OO features
as C++ can do, will C be less efficient than C++? Can we use C++ for
the huge projects mentioned above? or those projects didn't require
any modern features, e.g. Polymorphism? (that sounds terrible)
As you seem to note, if you restrict C++ to C-style, then you have the
runtime efficiency of C. If on the other hand you use C for typical C++
tasks, then you're unlikely to obtain the runtime-efficiency of C++.
Anyway, in both cases you're most likely using the wrong language for
the task: it's extremely difficult to restrict oneself to the pure C
subset of C++ (the compiler won't help), and emulating OO or template
things in C yields extremely large, complex and brittle code.
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
Q: What is the most annoying thing on usenet and in e-mail?