By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,849 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,849 IT Pros & Developers. It's quick & easy.

differences between c and c++

P: n/a
what are all the diferences between the two?
Jul 22 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
Bern wrote:
what are all the diferences between the two?


"++"

--
Salu2
Jul 22 '05 #2

P: n/a
On Sun, 8 Aug 2004 23:18:01 +0800, " Bern" <x@x.com> had a scratch and
wrote:
what are all the diferences between the two?


The main difference is in the personalities of people who program in
these languages.

People who program in C are level headed and precise. People who
program in C++ like to boast that it is a very complicated language
that takes time to master - that's why most of their code appears
unintelligible.

Or it could be that they're all a bunch of willy wavers doing the
technological equivalent of wearing the emperor's new cloths.

=====================

Pussie sHaveMo
reFunMeow MeowMeowPus
siesHaveMore FunMeowMeowMeo
wPussiesHaveMo reFunMeowMeowMeo
wPussiesHaveMor eFunMeowMeowMeowP
ussiesHaveMoreFu nMeowMeowMeowPussi
esHaveMoreFunMeo wMeowMeowPussiesHav
eMoreFunMeowMeowM eowPussiesHaveMor
eFunMeowMeowMeowP ussiesHaveMoreFunM
eowMeowMeowPussie sHaveMoreFunMeowMe owMeowPus
siesHaveM oreFunMeowMeowMe owPussiesHaveMore FunMeowMeowMe
owPussiesHave MoreFunMeowMeowM eowPussiesHaveM oreFunMeowMeowM
eowPussiesHaveM oreFunMeowMeow MeowPussiesHa veMoreFunMeowMeow
MeowPussiesHave MoreFunMeow MeowMeow PussiesHaveMoreFun
MeowMeowMeowPussi esHa veMoreFunMeowMeowMe
owPussiesHaveMoreF unMeowMeowM eowPussiesHaveMoreFu
nMeowMeowMeowPussie sHaveMoreFunMe owMeowMeowPussiesHav
eMoreFunMeowMeowMeo wPussiesHaveMoreFu nMeowMeowMeowPussie
sHaveMoreFunMeowMeo wMeowPussiesHaveMoreFu nMeowMeowMeowPussi
esHaveMoreFunMeowM eowMeowPussiesHaveMoreFu nMeowMeowMeowPuss
iesHaveMoreFunMe owMeowMeowPussiesHaveMoreFu nMeowMeowMeowP
ussiesHaveMor eFunMeowMeowMeowPussiesHaveMore FunMeowMeow
MeowPussi esHaveMoreFunMeowMeowMeowPussiesHave MoreF
unMe owMeowM eowPuss
iesHave MoreF unMeowMeowM
eowPussies Ha veMoreFunMeo
wMeowMeowP us si esHaveMoreFu
nMeowMeowM eow Pus siesHaveMore
FunMeowMeo wMeow Pussi esHaveMoreFu
nMeowMeow MeowPu ssiesH aveMoreFun
Meow MeowMeow Pussie
sHaveMoreFunMeowMeowMeowPussiesHaveM
oreFunMeowMeowMeowPussiesHaveMo
reFunMeowMeowMeowPussies
Jul 22 '05 #3

P: n/a
what are all the diferences between the two?


The main difference is in the personalities of people who program in
these languages.

People who program in C are level headed and precise. People who
program in C++ like to boast that it is a very complicated language
that takes time to master - that's why most of their code appears
unintelligible.

Or it could be that they're all a bunch of willy wavers doing the
technological equivalent of wearing the emperor's new cloths.

You are one naive, stupid individual.
-JKop
Jul 22 '05 #4

P: n/a
Bern posted:
what are all the diferences between the two?

The main difference is a thing called a "class". In C, you can group
variables together, like:

struct Dog
{
unsigned age;
const char* name;
bool has_a_tail;
};
In C++, you can add functions in with these structures:

struct Dog
{
unsigned age;
const char* name;
bool has_a_tail;

unsigned CalculateTailLength();

unsigned CalculateYearsToLive();
}

A structure which includes functions is referred to as a class.

C++ is really C with more features added, the main ones of which are:

Classes
References

But on top of that there are some actual changes, eg. in C:

void Blah();

that declares a function that takes any amount of arguments, while in C++ it
declares a function which take no arguments at all.

But at the end of it all: C++ is C with more features.
-JKop
Jul 22 '05 #5

P: n/a
" Bern" <x@x.com> skrev i meddelandet news:41********@news.starhub.net.sg...
what are all the diferences between the two?


A few major C++ features not available in C:
- Classes
- Templates
- Exception handling
- Function overloading
- Operator overloading
- Namespaces
- Standard library for templated collections, strings, common algorithms,
etc.

And a few minor ones:
- bool type
- Reference types
- Somewhat stricter type checking than C
- new/delete instead of malloc()/free()
- New syntax for declaring struct types

C++ is obviously more complex than C, but many of the added features are
designed to make life easier (string handling is a good example). Some
programmers like to use C++ as "a better C". Others think that the OO
features in C++ makes it more suitable for larger projects than C. Still
others prefer the relative simplicity and sparsity of C.

To explain the difference by enumerating features just gives part of the
picture. Another way to say it is that C++ is a multi-paradigm language,
with support for procedural, object-oriented and generic programming, while
C supports procedural programming only (it's possible to write OO code with
C, but it's not pretty). If this is a good or a bad thing is obviously a
matter of opinion. IMHO the standard library alone makes C++ worth the extra
learning effort.
Jul 22 '05 #6

P: n/a
Bradley Bungmunch wrote:
On Sun, 8 Aug 2004 23:18:01 +0800, " Bern" <x@x.com> had a scratch and
wrote:
what are all the diferences between the two?


The main difference is in the personalities of people who program in
these languages.

People who program in C are level headed and precise. People who
program in C++ like to boast that it is a very complicated language
that takes time to master - that's why most of their code appears
unintelligible.

Or it could be that they're all a bunch of willy wavers doing the
technological equivalent of wearing the emperor's new cloths.


I take it that you are one of those people who haven't mastered C++?

(note: the OP is just trolling)
Jul 22 '05 #7

P: n/a
"LNK2005" <km*****@hotmail.com> wrote in message
news:eSGRc.4926$vH5.4146@amstwist00...
" Bern" <x@x.com> skrev i meddelandet news:41********@news.starhub.net.sg...
what are all the diferences between the two?


A few major C++ features not available in C:
- Classes
- Templates
- Exception handling
- Function overloading
- Operator overloading
- Namespaces
- Standard library for templated collections, strings, common algorithms,
etc.

And a few minor ones:
- bool type
- Reference types
- Somewhat stricter type checking than C
- new/delete instead of malloc()/free()
- New syntax for declaring struct types

C++ is obviously more complex than C, but many of the added features are
designed to make life easier (string handling is a good example). Some
programmers like to use C++ as "a better C". Others think that the OO
features in C++ makes it more suitable for larger projects than C. Still
others prefer the relative simplicity and sparsity of C.

To explain the difference by enumerating features just gives part of the
picture. Another way to say it is that C++ is a multi-paradigm language,
with support for procedural, object-oriented and generic programming,

while C supports procedural programming only (it's possible to write OO code with C, but it's not pretty). If this is a good or a bad thing is obviously a
matter of opinion. IMHO the standard library alone makes C++ worth the extra learning effort.

And some people write C code claiming it to be C++ just because they are
using cout.
Jul 22 '05 #8

P: n/a

"Dag Viken" <da*******@earthlink.net> skrev i meddelandet
news:HA*****************@newsread2.news.pas.earthl ink.net...
"LNK2005" <km*****@hotmail.com> wrote in message
news:eSGRc.4926$vH5.4146@amstwist00...
" Bern" <x@x.com> skrev i meddelandet news:41********@news.starhub.net.sg...
what are all the diferences between the two?


A few major C++ features not available in C:
- Classes
- Templates
- Exception handling
- Function overloading
- Operator overloading
- Namespaces
- Standard library for templated collections, strings, common algorithms, etc.

And a few minor ones:
- bool type
- Reference types
- Somewhat stricter type checking than C
- new/delete instead of malloc()/free()
- New syntax for declaring struct types

C++ is obviously more complex than C, but many of the added features are
designed to make life easier (string handling is a good example). Some
programmers like to use C++ as "a better C". Others think that the OO
features in C++ makes it more suitable for larger projects than C. Still
others prefer the relative simplicity and sparsity of C.

To explain the difference by enumerating features just gives part of the
picture. Another way to say it is that C++ is a multi-paradigm language,
with support for procedural, object-oriented and generic programming,

while
C supports procedural programming only (it's possible to write OO code

with
C, but it's not pretty). If this is a good or a bad thing is obviously a
matter of opinion. IMHO the standard library alone makes C++ worth the

extra
learning effort.

And some people write C code claiming it to be C++ just because they are
using cout.


Well, those belong in the "C++ a better C" group, don't they?
Jul 22 '05 #9

P: n/a
JKop wrote:
Bern posted:

what are all the diferences between the two?


The main difference is a thing called a "class". In C, you can group
variables together, like:

struct Dog
{
unsigned age;
const char* name;
bool has_a_tail;
};
In C++, you can add functions in with these structures:

struct Dog
{
unsigned age;
const char* name;
bool has_a_tail;

unsigned CalculateTailLength();

unsigned CalculateYearsToLive();
}

A structure which includes functions is referred to as a class.

C++ is really C with more features added, the main ones of which are:

Classes
References

But on top of that there are some actual changes, eg. in C:

void Blah();

that declares a function that takes any amount of arguments, while in C++ it
declares a function which take no arguments at all.

But at the end of it all: C++ is C with more features.
-JKop


What about function overloading?
What about the "const" modifier?
Inheritance?
Public, private and protected accesses?
Mutable?
operators new and delete?

Actually, if you were to write a compiler for each, you would
recognize that they are two different languages that share
some things. C++ is not C with more features.
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #10

P: n/a
LNK2005 wrote:
" Bern" <x@x.com> skrev i meddelandet news:41********@news.starhub.net.sg...
what are all the diferences between the two?

A few major C++ features not available in C:
- Classes
- Templates
- Exception handling
- Function overloading
- Operator overloading
- Namespaces
- Standard library for templated collections, strings, common algorithms,
etc.

And a few minor ones:
- bool type
- Reference types
- Somewhat stricter type checking than C
- new/delete instead of malloc()/free()


FYI, malloc, calloc, realloc and free can be used in C++.
One _can_ mix them with undefined behavior.

The operators "new" and "delete" have not replaced
malloc() and free().

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #11

P: n/a
Bern wrote:
what are all the diferences between the two?


Why do you need to know?

I have spent 15 years programming in C++ and C.
The differences only pop up when I say to myself
"yes, you can't do that in the * language."

I've always looked at how I can accomplish
functionality using the language I'm given
(In a shop that uses only C, that is what I
am restricted to.)

Whether something can or can't be accomplished
easier, more efficiently, in less time, etc.,
in a language is not a concern. If message
handling can be performed "better" in C++ than
C, this does me no good when I am restricted
to C.

Forget the differences between languages.
Focus on how to use the languages to accomplish
simple objectives. When programming in LISP,
one doesn't have the brain cells to care about
the differences between LISP and C. Leave
the differences to the "worry worts".

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #12

P: n/a
Thomas Matthews <Th****************************@sbcglobal.net> wrote in message news:<J4**************@newssvr16.news.prodigy.com> ...
Thomas Matthews wrote

What about function overloading?
What about the "const" modifier?
Inheritance?
Public, private and protected accesses?
Mutable?
operators new and delete?
templates?
operator overloading?
exceptions?

Actually, if you were to write a compiler for each, you would
recognize that they are two different languages that share
some things. C++ is not C with more features.


Marcelo Pinto.
Jul 22 '05 #13

P: n/a
"LNK2005" <km*****@hotmail.com> wrote in message news:<eSGRc.4926$vH5.4146@amstwist00>...
A few major C++ features not available in C:
- Classes
- Templates
- Exception handling
- Function overloading
- Operator overloading
- Namespaces
- Standard library for templated collections, strings, common algorithms,
etc. Another way to say it is that C++ is a multi-paradigm language,
with support for procedural, object-oriented and generic programming, while
C supports procedural programming only (it's possible to write OO code with
C, but it's not pretty). If this is a good or a bad thing is obviously a
matter of opinion. IMHO the standard library alone makes C++ worth the extra
learning effort.


Exactly. It's not just about OOP. C++ out-of-the-box is usable but
ugly; the real benefits come from well-designed libraries that the
language makes possible. OOP is a part of that, but templates are at
least as important.

I just recently discovered Boost's lambda library, and frankly I'm in
awe. I've been looking for something like this for years to go with
std::algorithm.

list alist = list_with(2,3,5,7,11);
for_each(a.begin(), a.end(), if_then(_1 % 2 == 0, cout << _1 <<
endl));
/* print all even list elements */

I'm amazed that it's possible to do this with the tools C++ makes
available--I thought for sure co-routines needed direct language
support like in Ruby--but I guess it's a sign that the language
designers knew what they were doing.

Max Wilson
Jul 22 '05 #14

P: n/a

"Thomas Matthews" <Th****************************@sbcglobal.net> wrote in
message news:J4**************@newssvr16.news.prodigy.com.. .
Actually, if you were to write a compiler for each, you would
recognize that they are two different languages that share
some things. C++ is not C with more features.


That's the way it's creator described it, IIRC. C++ is a superset of C. It
does in fact have all the features of C, and then some, or, in your wording,
C with more features is exactly what it is.

But why are we feeding the trolls anyway?

James
Jul 22 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.