473,396 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C... Why not c++?

Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?
Nov 14 '05 #1
46 2028
Simple enough, the OO & template features are not needed on some
projects targeted to OS kernel development and device driver
development and other low-level libraries. Moreover, most of the
features require the C++ runtime library and it's too complex to
implement if you write a OS kernel. Note that in WHAT language do you
write the C++ runtime library?

Then you may say that C++ support C89 and some extensions and can write
code without OO. So why does C exist? I think maybe C++'s function
naming can't be compatible with C? To further improve C? I can't give
an exact reason. As to the compiler, C is often the first language to
implement and in GCC it's the background of Obj-C or C++ or Java or Ada.

Nov 14 '05 #2
Just a thought here but not relate to answering your question.

IMHO, I think C++ will give longer developing time due to there is more
things to be taken care of, like class, and private, public, protected,
virtual functions, also inheritance etc, and there is loads. There is more
restrictions in C++. Not a bad thing though. Instead, I think it will reduce
the maintenace time for sure.

To OP, can you exaplain to us why use C++ instead of C? :)

--
----------------------------------
remove "(n.o---s.p.a.m)" to reply
<dj***@excite.it> wrote in message
news:66**************************@posting.google.c om...
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?

Nov 14 '05 #3


"dj***@excite.it" wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


For What? a PC? a MainFrame, a Printer? a TV?
For many small systems the extra overhead for C++ is too much. The
memory is in Kbytes not Megabytes.
The question there is C or assembler ( and C is not always the winner).

Your question indicates to me you are a PC programmer. So what kind of
program. a driver? a simple user app? a fortune 500 company database
system? What about the development team? what are they good at? Hey
why not Java or C# or C.Net?
C++ is not a C replacement. It has its own pluses and minuses. For
small project it is programers choice. What he is good at is quickest.
For massive projects The project leader need to figure out the best
language. C++ does not guarantee the project is coded better, or is
done quicker.

BTW if to are trolling back under the bridge.
Nov 14 '05 #4
"dj***@excite.it" wrote:

Someone can exaplain me why use C instead C++?
Because C is a better lanugage for some tasks.

C++ is overly complicated, has way too many features and it
is way easier to write unreadable C++ than it is to write
unreadable C.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Bullshit. C++ is a far harder language to master than C.
Can you give me a valid reason for C?


It doesn't suck?

Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo no****@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"Compiling C code with warnings switched off is like practicing
high wire trapeze without a safety net. Even experienced
practitioners try to avoid it." -- me
Nov 14 '05 #5
dj***@excite.it wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.


Your question is backwards. It should be: when should you bother with
the pig-of-a-language C++ instead of using C? There are times when C++
is justified, although I would really rather use a real object-oriented
language for those.

Nov 14 '05 #6

<dj***@excite.it> wrote

Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Apart from a few minor details, C++ is designed for object-oriented designs.
So the question really becomes, why use procedural rather than OO
techniques?
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code I really don't
understand why the same things cannot be written in c++.
Languages are equivalent. I'm currently implementing an OO adventure in
stright C, which is more trouble than its worth (wish i could use Java but I
can't)
Using c++ it's possble to reduce developing time achieving the same result. That's just Bjarne Strousup's propaganda. In certain carefully-chosen cases
he is of course correct. However generally an object-oriented design takes a
lot longer to implement than a procedural one, because you have two
dependency hierarchies (the object inheritance hierarchy and the object call
hierarchy) rather than one (the function call tree), so it is much more
difficult to produce an elegant design. However OO really comes into its own
when you want a third party programmer to extend your functions without
recompiling or modifying your code.
Can you give me a valid reason for C?

The British army recently bought an assault rifle from a Swedish company,
and asked for the automatic fire option to be taken out. You might ask, what
is the point of that, since a gun which can fire bursts or single shots can
do everything that a single-shot gun can do, and more? The reason was that,
in the heat of battle, it was thought that soldiers would fire wildly and
waste ammunition. This consideration outweighed the cases when firing a
sustained burst would be beneficial.
It is the same with C++. From experience, programmers will forever play with
the language if allowed to program in C++. They try out templates, and
multiple inheritance, and experiment a bit with virtual functions or
operator overloading to see how they work. In C they just get the job done.
Nov 14 '05 #7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ha****@hotmail.com wrote:
| Simple enough, the OO & template features are not needed on some
| projects targeted to OS kernel development and device driver
| development and other low-level libraries. Moreover, most of the
| features require the C++ runtime library and it's too complex to
| implement if you write a OS kernel. Note that in WHAT language do you
| write the C++ runtime library?

All of this is true enough, and those reasons can also be used to favor
assembly over C.

|
| Then you may say that C++ support C89 and some extensions and can write
| code without OO.

Then he would be wrong. C++ is not a strict superset of C89 or C99, and
a C++ compiler in conforming mode should not accept every conforming C89
program.

| So why does C exist? I think maybe C++'s function naming can't be
| compatible with C?

This is a rather bizarre statement. I really can't tell what you mean by it.

| To further improve C?

Only rarely do modifications to C++ become modifications to C. It
usually wouldn't make any sense to apply a C++ feature to C.

| I can't give an exact reason. As to the compiler, C is often the first
| language to implement and in GCC it's the background of Obj-C or C++ or
| Java or Ada.
|

Wrong. gcc does /not/ convert everything to C. gcc has language-specific
frontends for /every/ language to convert the source to an internal
representation. (RTL, to be precise.) Read the documentation.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBhMd9KxatjOtX+j0RAoFbAJsEx+liERw6TkMvabEXrG CsSItNUwCeIGBY
mgT+5tHVNjwTKfvJv0HOWC4=
=FZ1E
-----END PGP SIGNATURE-----
Nov 14 '05 #8
dj***@excite.it wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?

It's easier to make a 25 year old C program work on current systems than
it is likely to be with a 4 year old C++ program. I just heard that
CERN, which I suppose is one of the more competent organizations turning
out open source C++, doesn't want to maintain an important C++ package,
now that the original author went on to other pursuits. C programs are
sometimes written, accidentally or not, to have a reasonable lifetime.
Nov 14 '05 #9
Erik de Castro Lopo wrote:
"dj***@excite.it" wrote:
Someone can exaplain me why use C instead C++?


Because C is a better lanugage for some tasks.

C++ is overly complicated, has way too many features and it
is way easier to write unreadable C++ than it is to write
unreadable C.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.


Bullshit. C++ is a far harder language to master than C.


Please don't use strong language in a completely inappropriate context.
If you can't contribute something useful, be quiet.

By the way, both c++ and c have advantages and disadvantages, which have
been outlined in several documents. Simply referring to a flat learning
curve isn't enough.
Can you give me a valid reason for C?


It doesn't suck?


You shouldn't probably answer if you're biased.
Nov 14 '05 #10
Erik de Castro Lopo wrote:
"dj***@excite.it" wrote:
Someone can exaplain me why use C instead C++?


Because C is a better lanugage for some tasks.

C++ is overly complicated, has way too many features and it
is way easier to write unreadable C++ than it is to write
unreadable C.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.


Bullshit. C++ is a far harder language to master than C.


Please don't use strong language in a completely inappropriate context.
If you can't contribute something useful, be quiet.

By the way, both c++ and c have advantages and disadvantages, which have
been outlined in several documents. Simply referring to a flat learning
curve isn't enough.
Can you give me a valid reason for C?


It doesn't suck?


You shouldn't probably answer if you're biased.

--

Steve Graegert {C/C++ && Java && .NET}
CSI Technology Group (StReG)
<graegerts(AT)cs(DOT)technologies(DOT)de>
Nov 14 '05 #11
dj***@excite.it (dj***@excite.it) wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++


Because every platform under the sun has a C compiler, but most
of them don't have a C++ compiler, or do have one but it is
very quirky and poor at standards compliance.
Nov 14 '05 #12
djake wrote:
Someone can exaplain me why use C instead C++?
Until now I've never found explanation for this.
Every project written in C on which I've worked could be written in
C++, and when in nowadays happen still to see C code I really don't
understand why the same things cannot be written in C++. Using C++,
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


The only reason that C still exists is that
there are a large number of C programmers
that still aren't comfortable with C++.
There is no reason now to expect them to ever learn C++.
We are just waiting for them to retire or die.
Nov 14 '05 #13


"E. Robert Tisdale" wrote:
djake wrote:
Someone can exaplain me why use C instead C++?
Until now I've never found explanation for this.
Every project written in C on which I've worked could be written in
C++, and when in nowadays happen still to see C code I really don't
understand why the same things cannot be written in C++. Using C++,
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


The only reason that C still exists is that
there are a large number of C programmers
that still aren't comfortable with C++.
There is no reason now to expect them to ever learn C++.
We are just waiting for them to retire or die.


That maybe true for some projects, but not all. Talk to the Java / .Net
crowd an they will tell you C++ is the is dead too.
Few (if any) 8 bit CPUs run C++ , or ever will. For small projects is it
worth the bother?
Programmer should have more than 1 tool in the tool box.
Nov 14 '05 #14
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Kurzman wrote:

| Few (if any) 8 bit CPUs run C++ , or ever will.

This is nonsense. The CPU will run any object code it's handed. It
doesn't matter if the code comes from a C++ compiler, a Forth compiler,
a Prolog compiler, or a human being with toggle switches and LEDs.

You might not write code in C++ for an embedded system, but there might
not be a good reason not to, either. If gcc supports the target
platform, or if you write a backend that allows it to, you automatically
get a C++ compiler that targets that system. Then it's merely a matter
of analyzing the benefits C++ brings as opposed to the downsides.

(If you say that the 8-bit chip won't be running a C++ compiler, you
should realize that 8-bit chips are rarely used as development platforms
these days. It's much, much more common to write and compile the code on
a more capable machine, test it on an emulator, and only transfer it to
the physical target system once it's been tested and debugged.)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBhf/JKxatjOtX+j0RAqGwAJ0bqpf1lBU5fb0Fc/MHvNV7HHQcQgCeOYY6
oFAYHUTae9cbbWB7kwwhC5c=
=UCwa
-----END PGP SIGNATURE-----
Nov 14 '05 #15
Chris Barts wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Kurzman wrote:

| Few (if any) 8 bit CPUs run C++ , or ever will.

This is nonsense. The CPU will run any object code it's handed. It
doesn't matter if the code comes from a C++ compiler, a Forth compiler,
a Prolog compiler, or a human being with toggle switches and LEDs.


I think Neil didn't try to say that those 8 bit CPU's are incapable of
running C++, but that there aren't any C++ compilers to target those CPU's.

Mark

--
<<Remove the del for email>>
Nov 14 '05 #16
Chris Barts wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ha****@hotmail.com wrote:
| Simple enough, the OO & template features are not needed on some
| projects targeted to OS kernel development and device driver
| development and other low-level libraries. Moreover, most of the
| features require the C++ runtime library and it's too complex to
| implement if you write a OS kernel. Note that in WHAT language do you
| write the C++ runtime library?

All of this is true enough, and those reasons can also be used to favor
assembly over C.

In some situations assembly is favored over C. But if you write assembly
for a specific CPU, and you want to have the same program on another CPU
you can start from scratch again. So C's portability is also a big issue.

| I can't give an exact reason. As to the compiler, C is often the first
| language to implement and in GCC it's the background of Obj-C or C++ or
| Java or Ada.
|

Wrong. gcc does /not/ convert everything to C. gcc has language-specific
frontends for /every/ language to convert the source to an internal
representation. (RTL, to be precise.) Read the documentation.


I think ha****@hotmail.com ment that the Obj-C/C++/Java/Ada compiler
itself is written in C since C is often the first language a compiler is
written for.

Mark

--
<<Remove the del for email>>
Nov 14 '05 #17

"Chris Barts" <ch************@gmail.com> wrote in message
news:4P********************@onewest.net...

<snip>
(If you say that the 8-bit chip won't be running a C++ compiler, you
should realize that 8-bit chips are rarely used as development platforms
these days.


Depends what you call 'development platform'. Most compilers that *target*
8-bits systems run on 32-bit systems (and for a good reason). If that was
intended, you are certainly right.

However, when writing for an 8-bit platform I wish to note the following:
C++ *tends* to produce 'fat' code due to all the stuff it does automatically
for you and the routinelets (c'tor, d'tor, etc) it requires. If you choose
(Babbage, Turing, Neumann and Dijkstra forbid) to use STL components on an
8-bit (Say) Atmel ATMega (64kx16) or Motorola 68HC11 you will get into
footprint problems *very* fast. Besides, I am curious how OO compilers
handle Harvard-architectures, since many u-controllers are not
Turing-machines.

C, OTOH, tends (if some care is taken and a good optimizing compiler is
used) to produce quite 'lean' object-code, which will get you into footprint
problems a lot less fast.

The above, of course, merely rests on my expirience and 'proof' is not the
plural of anecdote.
Nov 14 '05 #18
dj***@excite.it wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


Why C?

Contrary to the opinions of most people in this group I think that C has
many advantages over C++: simplicity, being the most important.

I do not think that C is a language for people that do not want to
learn anything else (as Mr Tisdale remarks) but I am of the opinion that
C can be used as a general purpose programming language where you can
develop GUI application and many other kinds of software.

C is not "object oriented" and as such, it doesn't impose a framework
on the programmer that is implicit n the whole language. You are free,
in C, to use the paradigm that fits the application best.

I do not see C as dead and static, on the contrary, I have tried within
the lcc-win32 compiler system to introduce extensions that make C
programming easier without introducing undue complexity: default
arguments, operator overloading, and some others.

C++ is seldom portable, and even code that compiled 4 years ago will not
compile in more recent versions of the same compiler. When you need
software that will have to be rewritten in a few years, you can use it.
For software that needs to run longer, C is the language of choice.

jacob

http://www.cs.virginia.edu/~lcc-win32
Nov 14 '05 #19
> The only reason that C still exists is that
there are a large number of C programmers
that still aren't comfortable with C++.
There is no reason now to expect them to ever learn C++.
We are just waiting for them to retire or die.


Happy trolling!
I think you just deserve a plonk for that fine analysis.
Nov 14 '05 #20
On 30 Oct 2004 17:30:49 -0700, dj***@excite.it (dj***@excite.it)
wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


Your premise is incorrect. I write in both C and C++, and almost
always C++ takes *more* development time, not less.

--
Al Balmer
Balmer Consulting
re************************@att.net
Nov 14 '05 #21
dj***@excite.it (dj***@excite.it) wrote in message news:<66**************************@posting.google. com>...
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


1. C is a smaller language, both in terms of the grammar and
libraries and in terms of the object code that is produced. There are
times when the overhead incurred by the tools that make C++ worth
using over C (such as the STL) outweighs the convenience.

2. Most of today's senior programmers started out with C and feel
more comfortable using something they know well.

FWIW, I'm seeing less and less new development being done in C, at
least in my particular domain (i.e., server-side, non-graphical
stuff).
Nov 14 '05 #22


Chris Barts wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Kurzman wrote:

| Few (if any) 8 bit CPUs run C++ , or ever will.

This is nonsense. The CPU will run any object code it's handed. It
doesn't matter if the code comes from a C++ compiler, a Forth compiler,
a Prolog compiler, or a human being with toggle switches and LEDs.

You might not write code in C++ for an embedded system, but there might
not be a good reason not to, either. If gcc supports the target
platform, or if you write a backend that allows it to, you automatically
get a C++ compiler that targets that system. Then it's merely a matter
of analyzing the benefits C++ brings as opposed to the downsides.

(If you say that the 8-bit chip won't be running a C++ compiler, you
should realize that 8-bit chips are rarely used as development platforms
these days. It's much, much more common to write and compile the code on
a more capable machine, test it on an emulator, and only transfer it to
the physical target system once it's been tested and debugged.)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBhf/JKxatjOtX+j0RAqGwAJ0bqpf1lBU5fb0Fc/MHvNV7HHQcQgCeOYY6
oFAYHUTae9cbbWB7kwwhC5c=
=UCwa
-----END PGP SIGNATURE-----


Yes They don't Laugh, They don't cry they just run programs.
The problem is when you 4K to 64K of code an 64K memory (256 bytes on a lot
of them)
C++ will not make the object code. PIC has several C compilers, BASIC Forth,
No C++;
8051 every thing including 1 C++ compiler. But It uses up most of the
resources.
small footprint is the key the PIC C compiler $900 US 8051 $1500
Big Money for a PC. But big savings if it fits you in the next small chip.

Nov 14 '05 #23


Alan Balmer wrote:
On 30 Oct 2004 17:30:49 -0700, dj***@excite.it (dj***@excite.it)
wrote:
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


Your premise is incorrect. I write in both C and C++, and almost
always C++ takes *more* development time, not less.

--
Al Balmer
Balmer Consulting
re************************@att.net


Well you must be doing it wrong C++ always takes less time and makes
better code.
Wow trolling is fun... well back to the bridge.

Nov 14 '05 #24
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jacob navia wrote:
|
| Why C?
|
| Contrary to the opinions of most people in this group I think that C has
| many advantages over C++: simplicity, being the most important.

In more ways than one. I would agree with this analysis.

(Oh, and the group is comp.lang.c. I don't think too many people here
really wish they were posting to comp.lang.c++. ;))

|
| I do not think that C is a language for people that do not want to
| learn anything else (as Mr Tisdale remarks) but I am of the opinion that
| C can be used as a general purpose programming language where you can
| develop GUI application and many other kinds of software.

You can indeed develop GUI applications in C, as the Gnome project has
proven. GUI applications are more commonly developed in an
object-oriented style, however, because the OO ideas about object
frameworks seem to map well to the domain of graphical applications.

|
| C is not "object oriented" and as such, it doesn't impose a framework
| on the programmer that is implicit n the whole language. You are free,
| in C, to use the paradigm that fits the application best.

This is where I disagree. C++ is more multiparadigmatic than C, by
almost any metric. You are not required to use objects in C++. You can
write reams of C++ code without once defining a class or inheriting from
one.

Your above statement is simply wrong. That isn't a matter of opinion.

|
| I do not see C as dead and static, on the contrary, I have tried within
| the lcc-win32 compiler system to introduce extensions that make C
| programming easier without introducing undue complexity: default
| arguments, operator overloading, and some others.

And none of that is relevant to C or to this newsgroup. I doubt the next
Standards committee will look at lcc-win32 (does lcc exist on any
non-win32 platforms?) for a list of features C needs. You'd have better
luck trying to convince the gcc people that your extensions would work
well in their C frontend, simply because what's in gcc is at least known
to a very wide community.

|
| C++ is seldom portable, and even code that compiled 4 years ago will not
| compile in more recent versions of the same compiler. When you need
| software that will have to be rewritten in a few years, you can use it.
| For software that needs to run longer, C is the language of choice.

You could have said the same things about C over a decade ago, when C89
conformance was still iffy in major compilers. Conforming C++ compilers
have existed for a while now, and conforming C++ programs are guaranteed
to keep working for a long, long time. C++ written to compile on
nonstandard compilers will unfortunately become a hassle for future
programmers, but there is little reason to code that way now.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBhzxNKxatjOtX+j0RAjKxAJ9+BCcFWE4eCdJm10mMVn TBXI/Z+ACfScH1
7KlmQEWOZmvqIdfBYzLCxo8=
=5l5R
-----END PGP SIGNATURE-----
Nov 14 '05 #25
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Capstar wrote:
| Chris Barts wrote:
|
|> -----BEGIN PGP SIGNED MESSAGE-----
|> Hash: SHA1
|>
|> ha****@hotmail.com wrote:
|> | Simple enough, the OO & template features are not needed on some
|> | projects targeted to OS kernel development and device driver
|> | development and other low-level libraries. Moreover, most of the
|> | features require the C++ runtime library and it's too complex to
|> | implement if you write a OS kernel. Note that in WHAT language do you
|> | write the C++ runtime library?
|>
|> All of this is true enough, and those reasons can also be used to favor
|> assembly over C.
|>
|
| In some situations assembly is favored over C. But if you write assembly
| for a specific CPU, and you want to have the same program on another CPU
| you can start from scratch again. So C's portability is also a big issue.

Very, very true. With assembly code, you can only `port' the structure
and algorithms, which isn't nearly as nice as being able to reuse whole
source files.

|
|>
|> | I can't give an exact reason. As to the compiler, C is often the first
|> | language to implement and in GCC it's the background of Obj-C or C++ or
|> | Java or Ada.
|> |
|>
|> Wrong. gcc does /not/ convert everything to C. gcc has language-specific
|> frontends for /every/ language to convert the source to an internal
|> representation. (RTL, to be precise.) Read the documentation.
|
|
| I think ha****@hotmail.com ment that the Obj-C/C++/Java/Ada compiler
| itself is written in C since C is often the first language a compiler is
| written for.

Hm. I didn't think of that interpretation. You're possibly correct, now
that I'm reparsing the sentence with your interpretation in mind.

And, yes, it is true that gcc itself is written in C, or at least a
variant of C that can be compiled with gcc and some other compilers.
(Which becomes a problem on MS-DOS, as gcc is the only compiler that can
compile gcc under that system. This is resolved by simply downloading
binaries the first time around.)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBhz2uKxatjOtX+j0RAi8NAJ9nEoUwo6KyaTeZfvzcol OgneLa/QCeLmgT
876a8zXXiQVOyFkkzEzGGjs=
=dXb1
-----END PGP SIGNATURE-----
Nov 14 '05 #26
dj***@excite.it (dj***@excite.it) wrote in message news:<66**************************@posting.google. com>...
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


I'm not sure this is one topic, but anyway:

Have you ever met a programmer who knows C++, all of it? I haven't
and I don't believe they exist. All C++ programmers write in their
own particular subset of the language. Some use objects, but
otherwise use the language like C, others use the STL but little else,
still others use almost all of it.

This can make coding easier, but makes understanding the code of
others frightening.
Nov 14 '05 #27

"Rob Thorpe" <ro***********@antenova.com> wrote in message
news:1a**************************@posting.google.c om...

<snip>
This can make coding easier, but makes understanding the code of
others frightening.


Depends. Well written (structured) C++ is quite easy to follow, since all
you need to know about an object is it's interface. But then again...

C offers you enough rope to hang yourself.
C++ offers a fully equipped firing squad, a last cigarette and a blindfold.
Nov 14 '05 #28
Hi all,

i'm surprised about interest dedicated to the issue proposed by
me. But I think many answer are only opinion. I invite anyone to send
example or demonstration code about his theory.
For example demonstrate C++ is more fast then C, sending the
respective test code.

Still thanks for interest!!

__sysDown
jo*******@my-deja.com (John Bode) wrote in message news:<43**************************@posting.google. com>...
dj***@excite.it (dj***@excite.it) wrote in message news:<66**************************@posting.google. com>...
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


1. C is a smaller language, both in terms of the grammar and
libraries and in terms of the object code that is produced. There are
times when the overhead incurred by the tools that make C++ worth
using over C (such as the STL) outweighs the convenience.

2. Most of today's senior programmers started out with C and feel
more comfortable using something they know well.

FWIW, I'm seeing less and less new development being done in C, at
least in my particular domain (i.e., server-side, non-graphical
stuff).

Nov 14 '05 #29
"dj***@excite.it" wrote:

i'm surprised about interest dedicated to the issue proposed by
me. But I think many answer are only opinion. I invite anyone to
send example or demonstration code about his theory.
For example demonstrate C++ is more fast then C, sending the
respective test code.


No, don't. It would be off-topic. And please stop the rude
topposting.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #30
<dj***@excite.it> wrote in message
news:66**************************@posting.google.c om...
Hi all,

i'm surprised about interest dedicated to the issue proposed by
me.
Comparing computer languages always tends to
induce religious fervor. Also note that language
comparisons are not topical here.
But I think many answer are only opinion. I invite anyone to send
example or demonstration code about his theory.
For example demonstrate C++ is more fast then C, sending the
respective test code.


Nobody can validly claim that C or C++ is 'faster' than
the other. Neither of the specifications for C or C++
make any requirements for speed. Speed is dictated by
the host platform, often aided by good quality compiler
implementations. Further aided by the programmer using
thoughtfulness when designing algorithms. E.g. one could
easily write and compile a C program which would run more
slowly than an interpreted BASIC program which does the
same things, on the same machine.

-Mike
Nov 14 '05 #31
"Rob Thorpe" <ro***********@antenova.com> wrote in message
news:1a**************************@posting.google.c om...
dj***@excite.it (dj***@excite.it) wrote in message

news:<66**************************@posting.google. com>...
Someone can exaplain me why use C instead C++? Until now i've never
found exaplanation for this.
Every project written in C on which i've worked could be written in
c++, and when in nowadays happen still to see C code i really don't
understand why the same things cannot be written in c++. Using c++
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


I'm not sure this is one topic, but anyway:

Have you ever met a programmer who knows C++, all of it?


I haven't. And imo anyone who says they do is not
being truthful. I don't think Mr. Stroustroup himself
would make such a claim.

-Mike
Nov 14 '05 #32
The lcc-win32 compiler compiles the gcc source code.
(11 MB)

It took me a lot of effort and now it is a standard
benchmark.

Compiling all that code without errors is quite a test
for any C compiler. I have a version (2.95.x) since years
and I compiled it with MSVC, Intel compiler, and BCC.

All produce exactly the same text file when they compile
a preprocessed source of approx 200K except borland, that
crashed a long time ago, and I haven't looked at more
recent versions.

As many GNU software packages the compiler is very difficult
to understand. I would say there are no more than a dozen
people in the world that understand all that throughout.

Compared to that, the whole code of lcc-win32 is less than
1MB, an order of magnitude simpler.

Yes, gcc does more things, and it is another scale. I just
think that an experimental compiler should be small.

Nov 14 '05 #33
Mike Wahler wrote:
<dj***@excite.it> wrote in message
news:66**************************@posting.google.c om...
Hi all,

i'm surprised about interest dedicated to the issue proposed by
me.

Comparing computer languages always tends to
induce religious fervor. Also note that language
comparisons are not topical here.

But I think many answer are only opinion. I invite anyone to send
example or demonstration code about his theory.
For example demonstrate C++ is more fast then C, sending the
respective test code.

Nobody can validly claim that C or C++ is 'faster' than
the other. Neither of the specifications for C or C++
make any requirements for speed.


I agree. And this childish excitement about "speed".

Speed for what?

If I give you a wrong result in 0.000000000001 seconds
or a correct one in 0.001 seconds which one you prefer?

We are speaking about software maintenance, software
complexity and the need (from my viewpoint) of simpler
languages that programmers can fully understand.

No one is talking "speed" of C++ since any C++ algorithm
can be written in C and the other way around. This is
ridiculous.

C++ introduces good concepts like genericity, templates,
and other stuff. The problem with it is if the cost of
those improvements is not too high. Can't we make it
simpler?

For instance we can get rid of the need for automatic
constructors/destructors with a GC!

Many C++ problems come from the fact that blindly copy
constructors, and other artificial procedures are generated
to maintain object creation/destruction in a managed
way.

The GC offers a solution to avoid the whole stuff.

Just call *yourself* new_Contact("John Doe", 35, married,2);
and leave the destructor to the GC.



Nov 14 '05 #34
"dandelion" <da*******@meadow.net> wrote in message news:<41***********************@dreader14.news.xs4 all.nl>...
"Rob Thorpe" <ro***********@antenova.com> wrote in message
news:1a**************************@posting.google.c om...

<snip>
This can make coding easier, but makes understanding the code of
others frightening.
Depends. Well written (structured) C++ is quite easy to follow,


Have you ever seen well structured C++? In the code I've worked on,
which I'll admit is not extensive, I haven't.
since all
you need to know about an object is it's interface.
Not to maintain it. The philosophy of some programmers is that if a
bit of their code is untidy, but has well defined outputs and inputs
then, the untidiness doesn't matter. This is fine until the code has
to be changed.
But then again...

C offers you enough rope to hang yourself.
C++ offers a fully equipped firing squad, a last cigarette and a blindfold.


Alas, something most of us know well.
Nov 14 '05 #35

"Rob Thorpe" <ro***********@antenova.com> wrote in message
news:1a**************************@posting.google.c om...
"dandelion" <da*******@meadow.net> wrote in message news:<41***********************@dreader14.news.xs4 all.nl>...
"Rob Thorpe" <ro***********@antenova.com> wrote in message
news:1a**************************@posting.google.c om...

<snip>
This can make coding easier, but makes understanding the code of
others frightening.


Depends. Well written (structured) C++ is quite easy to follow,


Have you ever seen well structured C++?


Yes.
In the code I've worked on, which I'll admit is not extensive, I haven't.
Improve.
since all
you need to know about an object is it's interface.


Not to maintain it. The philosophy of some programmers is that if a
bit of their code is untidy, but has well defined outputs and inputs
then, the untidiness doesn't matter. This is fine until the code has
to be changed.


That's one of the common pitfalls. Point taken.

However, in my view, OO-design is not a replacement of the traditional
methods.

Structured programming is the foundation
Modular programming the first floor
OO-Design the attic.

So, if you want to go OO, first become expert in structured and modular
programming and *use* those techniques.
But then again...

C offers you enough rope to hang yourself.
C++ offers a fully equipped firing squad, a last cigarette and a

blindfold.
Alas, something most of us know well.


It's allright. Just don't shout "FIRE!". And frankly i've seen quite a lot
of *very* good C++, which ws easy to follow and modify.

And, yes... I've used C++ professionally for 6 years. The major pain in the
posterior is that it's a moving target (or has been for quite some time).
Nov 14 '05 #36
On the Sun, 31 Oct 2004 20:18:53 -0800, E. Robert Tisdale wrote:
djake wrote:
Someone can exaplain me why use C instead C++?
Until now I've never found explanation for this.
Every project written in C on which I've worked could be written in
C++, and when in nowadays happen still to see C code I really don't
understand why the same things cannot be written in C++. Using C++,
it's possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?


The only reason that C still exists is that
there are a large number of C programmers
that still aren't comfortable with C++.
There is no reason now to expect them to ever learn C++.
We are just waiting for them to retire or die.


I code my own programs for my work (I'm a physicist) and I never felt the need
to use C++. With C, I just get the job done.

--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/
Nov 14 '05 #37
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!
Nov 14 '05 #38
dj***@excite.it wrote:
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!

Perhaps you should post the sources and makefiles are I cannot even get them to
compile on my computer.
Nov 14 '05 #39
dj***@excite.it wrote:
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!


Well, after fixing several bugs in the original code, like the argv[2],
these are my results. Note that C is 15 times faster than C++. Both
programs were compiled with gcc using -O3 and -DNDEBUG.

~/tmp/cc boa@wintendo $ time ./c numbers
number of elements= 1000000, median= 1.07238e+09, mean= 1.07275e+09

real 0m2.071s
user 0m2.022s
sys 0m0.040s
~/tmp/cc boa@wintendo $ time ./c numbers
number of elements= 1000000, median= 1.07238e+09, mean= 1.07275e+09

real 0m2.053s
user 0m2.042s
sys 0m0.010s
~/tmp/cc boa@wintendo $ time ./c++ numbers
number of elements= 1000000, median= 1.07238e+09, mean= 1.07275e+09

real 0m30.852s
user 0m30.343s
sys 0m0.030s
~/tmp/cc boa@wintendo $ time ./c++ numbers
number of elements= 1000000, median= 1.07238e+09, mean= 1.07275e+09

real 0m31.954s
user 0m30.213s
sys 0m0.100s
~/tmp/cc boa@wintendo $

I guess you're not very good at neither testing nor trolling.

Bjørn
Nov 14 '05 #40

<dj***@excite.it> wrote in message
news:66**************************@posting.google.c om...
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!

The free-fall to hell is markedly quicker than the ascent to heaven. What
point is trying to win a race where Mr. Gates shifts the finish line
according to whim? MPJ
Nov 14 '05 #41
Quoth Merrill & Michele on or about 2004-11-25:
C++ is faster!!!

The free-fall to hell is markedly quicker than the ascent to heaven. What
point is trying to win a race where Mr. Gates shifts the finish line
according to whim? MPJ


Congratulations, that almost made sense.

-trent
Nov 14 '05 #42
"Trent Buck"
Quoth Merrill & Michele on or about
[OP: ]C++ is faster!!!

The free-fall to hell is markedly quicker than the ascent to heaven. What point is trying to win a race where Mr. Gates shifts the finish line
according to whim? MPJ


Congratulations, that almost made sense.


If that only "almost" makes sense you've got one type of problem. If you
think I'm in the mood for any more ad hominem, you err in a different way.
MPJ
Nov 14 '05 #43
> If that only "almost" makes sense you've got one type of problem. If you
think I'm in the mood for any more ad hominem, you err in a different way.
MPJ


Congratulations. That was sarcasm, not ad-hominem. You err.
Nov 14 '05 #44
On 25 Nov 2004 08:42:52 -0800, dj***@excite.it
<dj***@excite.it> wrote:
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!


Well, it sometimes has more efficient libraries (and as BS points out,
some of them are intrinsically more efficient because they know the
types of the items they are handling, like sort versus qsort). On the
other hand, some of the C++ libraries are less efficient in other ways
(particularly memory usage, some implementations of strings are horribly
wasteful of both memory and time because they copy rather than using
reference counting).

Compiling, however, is much slower for C++ than for C (on my machine,
using the same compiler on the same code the ratio is typically 2:1;
with equivalent but idiomatic C++ code (for instance those two BS
examples) it is more) and uses a lot more memory. And the executable
files for idiomatic C++ code are always bigger (for C code compiled as
C++ -- where that is valid -- they are about the same).

And of course one can depend on a C compiler being available on any real
operating system on a production machine, whereas C++ compilers are
still only on a minority of them (and those are ones used for
development)...

Chris C
Nov 14 '05 #45
Merrill & Michele wrote:
<dj***@excite.it> wrote in message
news:66**************************@posting.google.c om...
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!


The free-fall to hell is markedly quicker than the ascent to heaven. What
point is trying to win a race where Mr. Gates shifts the finish line
according to whim? MPJ

Ahem... This is a neutral group. Please keep Billy and Linny out of here.

--
Imanpreet Singh Arora
Mailto: teerpnami@@liamg..moc
It's @gmail, rest should be obvious.
Nov 14 '05 #46
I confirm c++ is the fastest. My test confirm it's more powerful
particularly for data elaboration, probably for better algorhytm.
There are no rilevable difference between C and C++ during
hardware access.

Thanks

Chris Croughton <ch***@keristor.net> wrote in message news:<sl******************@ccserver.keris.net>...
On 25 Nov 2004 08:42:52 -0800, dj***@excite.it
<dj***@excite.it> wrote:
This demonstrate how c++ is faster then C.

On my PC C++ run 18 times more fast then C.

Look at:

http://www.research.att.com/~bs/new_learning.pdf

Try yourself the respective C and C++ code sample at pages 4 and 5.
Create a big file with a list of number to elaborate and sort and add
a logging for the time (one at the start and one at the end of main in
both files).

compile these two source files and see yourself at logs.

C++ is faster!!!


Well, it sometimes has more efficient libraries (and as BS points out,
some of them are intrinsically more efficient because they know the
types of the items they are handling, like sort versus qsort). On the
other hand, some of the C++ libraries are less efficient in other ways
(particularly memory usage, some implementations of strings are horribly
wasteful of both memory and time because they copy rather than using
reference counting).

Compiling, however, is much slower for C++ than for C (on my machine,
using the same compiler on the same code the ratio is typically 2:1;
with equivalent but idiomatic C++ code (for instance those two BS
examples) it is more) and uses a lot more memory. And the executable
files for idiomatic C++ code are always bigger (for C code compiled as
C++ -- where that is valid -- they are about the same).

And of course one can depend on a C compiler being available on any real
operating system on a production machine, whereas C++ compilers are
still only on a minority of them (and those are ones used for
development)...

Chris C

Nov 14 '05 #47

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.