f



C++ or C?

somebody told me that c++ is superior to c while others insist that c++
is just a junk.
I don't know which to follow.I want to know exactly the difference
between them, and their respective advantage and disadvantage.

0
Magcialking
8/10/2006 3:12:03 AM
comp.lang.c++ 49423 articles. 7 followers. Post Follow

14 Replies
1094 Views

Similar Articles

[PageSpeed] 1

Magcialking wrote:
> somebody told me that c++ is superior to c while others insist that
> c++ is just a junk.
> I don't know which to follow.I want to know exactly the difference
> between them, and their respective advantage and disadvantage.

www.google.com  and read about the differences until you're blue in
the face.

Oh, while you're at it, look up "trolling", and try not to do it.

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


0
v.Abazarov (13256)
8/10/2006 3:23:01 AM
Magcialking wrote:

> somebody told me that c++ is superior to c while others insist that c++
> is just a junk.

C++ was invented later, and it's easier to program. That means many new 
libraries, using it, are often fat and bloated.

However, C++ permits as many efficiencies as C. You should write clean C++ 
style code, and keep it not ugly and bloated. Then if it's slow, you can use 
C-style code that's more efficient. So ideally you can get the best of both 
worlds.

Now try comparing a C language to any other language. Tip: Don't go straight 
to Java. Get a high-level language like Ruby or Smalltalk, and learn to 
compare it to C++.

-- 
  Phlip
  http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!! 


0
phlipcpp (2771)
8/10/2006 3:23:43 AM
Magcialking wrote:
> somebody told me that c++ is superior to c while others insist that c++
> is just a junk.
> I don't know which to follow.I want to know exactly the difference
> between them, and their respective advantage and disadvantage.

Try to compare an apple and a pear.

The inventor of C++ Bjarne Stroustrup has a few things to say on the
subject: http://www.research.att.com/~bs/bs_faq.html

0
uralmutlu (22)
8/10/2006 3:44:48 AM
I heard that nearly 95% programs in the GNU world are written with C,
and except in the game industry, C is much more widely used, is that
true?

0
Magcialking
8/10/2006 4:03:22 AM
Magcialking wrote:

> I heard that nearly 95% programs in the GNU world are written with C,
> and except in the game industry, C is much more widely used, is that
> true?

C is much older, and is responsible for the majority of the programming 
infrastructure we use. Items like Unix, grep, Apache, Perl, and Berkeley 
Sockets were all written in C.

That's not because C is better; just because it's older. And C++ cannot yet 
compete for some platforms that only have C compilers. The most useful 
system things must port to such platforms, hence they must use C.

Modern development, for most platforms, that requires relatively high 
performance and portability will use C++. So your cell phone might run C++, 
and your videogame most likely will.

Curiously, many videogames use libraries like Renderware that are themselves 
written in C. This disadvantages some students, who learn its style, and 
then use that style inappropriately in their C++ code.

The question arises to what purpose you will put these answers. If you seek 
which language to learn, learn a soft easy one like Ruby first, and then 
learn C++. Only learn C as you need it.

If you want to pick a language to start a project, you should pick a soft 
one like Python, Ruby, or Smalltalk. Use soft languages to program faster, 
and only convert modules to C++ as you need.

Most videogames also use a soft layer, typically Lua, to program their 
high-level logic without worrying about the nuts-and-bolts that raw C++ 
requires.

-- 
  Phlip
  http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!! 


0
phlipcpp (2771)
8/10/2006 4:16:55 AM
On Wed, 09 Aug 2006 21:03:22 -0700, Magcialking wrote:

> I heard that nearly 95% programs in the GNU world are written with C,
> and except in the game industry, C is much more widely used, is that
> true?

It is true that most widely used GNU tools are written in C and not in
C++.  This is probably more for historical reasons than anything else. 
Many of those projects were started before C++ became as popular and
finding C programmers to contribute is easier.  To their credit many GNU
project managers won't rewrite in C++ until there is an overwhelming
reason to do so since the end result is more often a new C program that
simply uses some C++ constructs and achieves the worst of both worlds.

You gotta teach GNU developers to adequately document and professionally
engineer their code first.  open-source project docs are generally
TERRIBLE!


0
noone6680 (136)
8/10/2006 4:25:57 AM
In article <3FxCg.5380$1f6.3485@newssvr27.news.prodigy.net>, 
phlipcpp@yahoo.com says...

[ ... ]

> However, C++ permits as many efficiencies as C.

More, AAMOF. Essentially all of the basic techniques of C are available 
in C++, and C++ adds a few tricks of its own (especially via templates) 
that are difficult to match in C.

> You should write clean C++ 
> style code, and keep it not ugly and bloated. Then if it's slow, you can use 
> C-style code that's more efficient.

....or or many cases, well written C++ that's considerably better than 
you could reasonably plan on producing with C.

Don't get me wrong: I'm not trying to bash C at all. Nonetheless, for 
quite a few tasks, a C++ programmer can aspire to considerably more than 
simply matching the efficiency of C, especially in terms of speed. If 
your main concern is executable size, then C or extremly C-like coding 
usually work extremely well. Given the current prices of memory and hard 
drives, many people find larger executables quite reasonable if they run 
enough faster -- which they often do.

-- 
    Later,
    Jerry.

The universe is a figment of its own imagination.
0
jcoffin (2241)
8/10/2006 4:27:16 AM
On Wed, 09 Aug 2006 22:27:16 -0600, Jerry Coffin wrote:

> In article <3FxCg.5380$1f6.3485@newssvr27.news.prodigy.net>, 
> phlipcpp@yahoo.com says...
> 
> [ ... ]
> 
>> However, C++ permits as many efficiencies as C.
> 
> More, AAMOF. Essentially all of the basic techniques of C are available 
> in C++, and C++ adds a few tricks of its own (especially via templates) 
> that are difficult to match in C.

And of course something that folks don't know or try to forget is that C++
was originally called "C with classes" and C++ compilers were simply C
code preprocessors.


0
noone6680 (136)
8/10/2006 4:31:50 AM
Magcialking wrote:
> I heard that nearly 95% programs in the GNU world are written with C,
> and except in the game industry, C is much more widely used, is that
> true?

GNU mainly deals with OSs, drivers, compilers, etc and they are mainly
written in C.

You can't compare C to C++, a statement like "C is more widely used
than C++" doesn't make sense. Although, there is a relationship between
C and C++, they serve different purposes.

There are millions of application developers around the world and
application developers use c++, java, #c, etc. So even if there is more
C than C++ at the low level in our computers, I don't think anyone can
tell how widely C++ is used to build propriatery applications.

0
uralmutlu (22)
8/10/2006 4:40:22 AM
Phlip wrote:
> 
> Modern development, for most platforms, that requires relatively high 
> performance and portability will use C++. So your cell phone might run C++, 
> and your videogame most likely will.
> 
Cell phones are more likely a mix of C and (unfortunately) Java these days.

-- 
Ian Collins.
0
ian-news (10155)
8/10/2006 5:17:03 AM
Ian Collins wrote:
> Phlip wrote:
> >
> > Modern development, for most platforms, that requires relatively high
> > performance and portability will use C++. So your cell phone might run C++,
> > and your videogame most likely will.
> >
> Cell phones are more likely a mix of C and (unfortunately) Java these days.
>
> --
> Ian Collins.

Symbian is C++ and some philips models have a linux based OS with Qt.
However, majority of cell phones probably use C, or shall we say the
code and applications running on them is developed in C.

0
uralmutlu (22)
8/10/2006 5:34:01 AM
> somebody told me that c++ is superior to c while others insist that c++
> is just a junk.
> I don't know which to follow.I want to know exactly the difference
> between them, and their respective advantage and disadvantage.

Anyone who thinks C++ is superior to C, or vice-versa, is clearly so
ignorant that they should be dismissed out of hand.  There is no such
thing as 'superiority' with respect to programming languages, only ways
in which they excel or fail to excel.

If you'd care to ask a more narrowly-focused question, people can
probably give you more useful answers.

0
cipherpunk (71)
8/10/2006 6:07:48 AM
In article <pan.2006.08.10.04.31.50.723068@all.com>, noone@all.com 
says...

[ ... ]

> And of course something that folks don't know or try to forget is that C++
> was originally called "C with classes" and C++ compilers were simply C
> code preprocessors.

At least as I understand things, C with Classes started out as a set of 
macros, that were fed to a perfectly normal C compiler (along with your 
source code, of course).

IMO, most people would be better off forgetting most of this 
relationship when they're writing C++ code though -- IMO, one of the 
most common sources of poorly written C++ is authors who think and write 
too much like they're writing C with a few extra bells and whistles.

-- 
    Later,
    Jerry.

The universe is a figment of its own imagination.
0
jcoffin (2241)
8/10/2006 6:27:14 AM
uralmutlu@gmail.com wrote:
> Ian Collins wrote:
> 
>>Phlip wrote:
>>
>>>Modern development, for most platforms, that requires relatively high
>>>performance and portability will use C++. So your cell phone might run C++,
>>>and your videogame most likely will.
>>>
>>
>>Cell phones are more likely a mix of C and (unfortunately) Java these days.
>>
> Symbian is C++ and some philips models have a linux based OS with Qt.
> However, majority of cell phones probably use C, or shall we say the
> code and applications running on them is developed in C.
> 
A large number of the new operator branded phones use Java.

-- 
Ian Collins.
0
ian-news (10155)
8/10/2006 6:39:05 AM
Reply: