Why C++ is vastly superior to C

Ö

Öö Tiib

  TIOBE at least does not claim that their evaluations was »objective«!
  (Ok, you wrote »an attempt«.)


  Still, it is reasonable and helpful to look at the number of
  Sourceforge projects as another source.

On that level better take stackoverflow questions. There are about 26k
questions tagged C, 64k questions tagged C++ and 7k tagged both.
 
G

Gert-Jan de Vos

On that level better take stackoverflow questions. There are about 26k
questions tagged C, 64k questions tagged C++ and 7k tagged both.

The beauty of C is the elegance of its simplicity. It is a very simple
language and can be learned in a day. Yet it allows one to build
complex
programs with optimal performance.

The beauty of C++ on the other hand is its extensive support in the
language itself, its libraries and idioms to address the scalability
issues in large programs. There are solid, well described mechanisms
like user defined types, polymorphism, namespaces, exceptions,
templates, RAII, STL, function overloading, etc, etc, for problems
that can be solved by user code in C. The strength of the C solutions
will vary with the programmer, the C++ equivalents are well defined.

Of course there are more questions about C++ then about C, the C++
language is much larger because it addresses many software
development issues that C doesn't. The investment of learning C++
probably only pays of when you use it in mid to large scale software
projects, that also need its C style performance characteristics. If
you happen to know C++ quite well, it is great for small programs
too :)

Gert-Jan
 
R

Rui Maciel

Öö Tiib said:
On that level better take stackoverflow questions. There are about 26k
questions tagged C, 64k questions tagged C++ and 7k tagged both.

As C++ tends to be much more complex and as C tends to be "tamed" after
getting the hang of it's core language, naturally there is a tendency for
forum dedicated to C++ to end up generating more traffic than the C
counterpart. Therefore, the traffic generated by these languages on a
specific forum may not be that correlated with their market share.


Rui Maciel
 
R

Rui Maciel

Ian said:
C99 compilers are by no means universal. A lot of embedded (the
majority of C projects) projects are still stuck with C90 tools.

You have a point.


Rui Maciel
 
M

Man-wai Chang

"In conclusion, the reason why C is so vastly inferior to C++ as
described in this article can be summarized with one single sentence:
C has no support for RAII nor templates, while C++ does. That's two
of the most important features that make C++ by far the superior
language."

In the old days, C++ codes were first converted to C by preprocessor! ;)

--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and farces be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.38.6
^ ^ 15:34:01 up 6 days 9:06 0 users load average: 1.15 1.13 1.14
ä¸å€Ÿè²¸! ä¸è©é¨™! ä¸æ´äº¤! ä¸æ‰“交! ä¸æ‰“劫! ä¸è‡ªæ®º! è«‹è€ƒæ…®ç¶œæ´ (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
 
Ö

Öö Tiib

As C++ tends to be much more complex and as C tends to be "tamed" after
getting the hang of it's core language, naturally there is a tendency for
forum dedicated to C++ to end up generating more traffic than the C
counterpart.  Therefore, the traffic generated by these languages on a
specific forum may not be that correlated with their market share.

Most of the questions there are not about language (some always are
indeed lazy student homework questions) but practical questions about
operating systems, network services, libraries, algorithms,
frameworks, protocols or tools. People usually try to solve everyday
practical problems. For language itself they have manual or couple. I
think people tag with language they use so to not get some Python or
Visual Basic code example (or link) as response.
 
J

Juha Nieminen

Gert-Jan de Vos said:
The beauty of C is the elegance of its simplicity. It is a very simple
language and can be learned in a day.

You can't be serious.

The brevity of the language specification does not equate to the
simplicity of the language, and C is a prime example of this.

The simplicity of the language is measured by how complicated it is
to implement a given task with the language, not how long the the language
specification is. If that were the measurement, then brainfuck would be
much simpler than C. It certainly isn't.

In the case of C, its "simplicity" actually becomes a limiting factor,
not a beneficial one. The language offers no tools that would help writing
simple programs. Even small tasks can become overly complicated,
especially if dynamic memory management and data structures other than
basic arrays are involved.

As for "learning C in a day", you are quite a joker. There are people
who don't fully understand things like pointer arithmetic even after a
year of coding in C.
 
L

Lynn McGuire

You can't be serious.

The brevity of the language specification does not equate to the
simplicity of the language, and C is a prime example of this.

The simplicity of the language is measured by how complicated it is
to implement a given task with the language, not how long the the language
specification is. If that were the measurement, then brainfuck would be
much simpler than C. It certainly isn't.

In the case of C, its "simplicity" actually becomes a limiting factor,
not a beneficial one. The language offers no tools that would help writing
simple programs. Even small tasks can become overly complicated,
especially if dynamic memory management and data structures other than
basic arrays are involved.

As for "learning C in a day", you are quite a joker. There are people
who don't fully understand things like pointer arithmetic even after a
year of coding in C.

No joke. I have known several C programmers who did not get
the concept of pointers even after several years. Needless
to say, they were not great programmers.

Lynn
 
J

jacob navia

Le 16/05/11 17:08, Lynn McGuire a écrit :
Why C++ is vastly superior to C:
http://warp.povusers.org/programming/cplusplus_superior_to_c.html

"In conclusion, the reason why C is so vastly inferior to C++ as
described in this article can be summarized with one single sentence:
C has no support for RAII nor templates, while C++ does. That's two
of the most important features that make C++ by far the superior
language."

Lynn

Of course C++ is vastly superior than C.

We are in comp.lang.c++. Nobody will say otherwise.

:)
 
M

Michael Tsang

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lynn said:
Why C++ is vastly superior to C:
http://warp.povusers.org/programming/cplusplus_superior_to_c.html

"In conclusion, the reason why C is so vastly inferior to C++ as
described in this article can be summarized with one single sentence:
C has no support for RAII nor templates, while C++ does. That's two
of the most important features that make C++ by far the superior
language."


Even after 5 years of programming, I still seldom use inheritance. However,
I've coded lots of templates. The only use of inheritance by me until now is
in GUI programming, where everything can be represented in a class hierarchy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk3VDH4ACgkQZ1Turg5KUCnQmgCfba51u5iSDZyoKjvHAQfUU+j5
L0IAmgMJak4VzIdcOOoW5x1HY8fVz9Kl
=q5Il
-----END PGP SIGNATURE-----
 
K

Krice

Of course C++ is vastly superior than C.

The best proof is that C people say they can do everything
that C++ does in C. It tells that they need and love C++
features so much that they try to replicate them in C.
 
N

none

No joke. I have known several C programmers who did not get
the concept of pointers even after several years. Needless
to say, they were not great programmers.

Yup, I was once asked to look at a bug that was traced to receiving
the value of a pointer sent through a TCP socket from a different
device! Then you go and talk to the programmer and instead of
apologising and immediately noticing that he forgot to serialise the
data, he looks at you all confused with no understanding of why it is
a problem!
 
R

Rui Maciel

Michael said:
Even after 5 years of programming, I still seldom use inheritance.
However, I've coded lots of templates. The only use of inheritance by me
until now is in GUI programming, where everything can be represented in
a class hierarchy.

Are you familiar with basic OO design patterns?


Rui Maciel
 
M

MikeP

Krice said:
You can live without templates,

But your quality of life would suffer greatly as a result.
it's the least important feature

I disagree. In the set of mostly touted C++ features, I think exceptions
are the least important.
 
M

MikeP

Rui said:
Why would anyone extend the base language to incorporate something
which is easily implemented (and, better yet, extendable) through
other basic language constructs?

In attempt to achieve greater interoperability amongst programmers?
 
M

MikeP

Joshua said:
I want to emphasize this. Templates are nice for code reuse, but
several posters ignored IMHO the most important aspect of their
utility. Templates allow generic code and code reuse without runtime
overhead.

The trade-off (there always is one) being Template Code Bloat (TCB).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top