differences between c and c++

B

Bradley Bungmunch

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
 
J

JKop

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
 
J

JKop

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
 
L

LNK2005

Bern said:
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.
 
P

Peter van Merkerk

Bradley said:
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)
 
D

Dag Viken

LNK2005 said:
" Bern" <[email protected]> skrev i meddelandet news:[email protected]...

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.
 
T

Thomas Matthews

JKop said:
Bern posted:





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
 
T

Thomas Matthews

LNK2005 said:
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
 
T

Thomas Matthews

Bern said:
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
 
M

Marcelo Pinto

Thomas Matthews said:
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.
 
H

Hemlock

LNK2005 said:
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
 
A

Aguilar, James

Thomas Matthews said:
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
 

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
474,174
Messages
2,570,940
Members
47,486
Latest member
websterztechnologies01

Latest Threads

Top