473,322 Members | 1,409 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,322 software developers and data experts.

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.

Aug 10 '06 #1
14 1411
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
Aug 10 '06 #2
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!!!
Aug 10 '06 #3

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

Aug 10 '06 #4
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?

Aug 10 '06 #5
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!!!
Aug 10 '06 #6
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!
Aug 10 '06 #7
In article <3F*****************@newssvr27.news.prodigy.net> ,
ph******@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.
Aug 10 '06 #8
On Wed, 09 Aug 2006 22:27:16 -0600, Jerry Coffin wrote:
In article <3F*****************@newssvr27.news.prodigy.net> ,
ph******@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.
Aug 10 '06 #9

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.

Aug 10 '06 #10
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.
Aug 10 '06 #11

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.

Aug 10 '06 #12
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.

Aug 10 '06 #13
In article <pa****************************@all.com>, no***@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.
Aug 10 '06 #14
ur*******@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.
Aug 10 '06 #15

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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.