Re: Why We Use C Than C++...
- From: henryk.mueller@xxxxxx
- Date: 12 Jan 2006 09:19:52 -0800
> Another important factor is that C++ requires more run-time support
> code to work properly.
Nope.
The objective of C++ is that you do not pay for features you do not
use.
C++ is not faster or slower than C if you DO the same.
For example: C functions have no parameter "this". But static C++
function do not have a "this" parameter either.
So, compare only apples with apples....
I use C++ in an embedded environment. Mostly because of it's better
code encapsulation. You can write small and lean wrappers for
interfaces that actually contain mostly inline functions. So you have
no overhead but you can protect the user of your class from using it in
an unwanted way much better than in C, i.e. forget to call init in C
vs. do the init within the constructor.
There are a lot examples of C++ features that are done at compile time
and have no effect at runtime. They all help you to write more robust
code. Reference objects vs. pointers, const methods, const return
values and all this stuff...
The are only 3 reasons to use C over C++:
- you have no decent C++ compiler for your platform
- you have to continue a C project
- you are not allowed to use C++ because your boss still believes that
C++ is SLOW
Greets
Henryk
.
- Follow-Ups:
- Re: Why We Use C Than C++...
- From: Dag-Erling Smørgrav
- Re: Why We Use C Than C++...
- From: Chris Torek
- Re: Why We Use C Than C++...
- From: Mark McIntyre
- Re: Why We Use C Than C++...
- From: Keith Thompson
- Re: Why We Use C Than C++...
- References:
- Why We Use C Than C++...
- From: sonugeetha@xxxxxxxxx
- Re: Why We Use C Than C++...
- From: Richard Heathfield
- Re: Why We Use C Than C++...
- From: Dag-Erling Smørgrav
- Why We Use C Than C++...
- Prev by Date: Re: Why We Use C Than C++...
- Next by Date: [OT] Re: Chuck Norris can divide by zero
- Previous by thread: Re: Why We Use C Than C++...
- Next by thread: Re: Why We Use C Than C++...
- Index(es):
Relevant Pages
|