1,105,636 Community Members

c vs c++

Member Avatar
~s.o.s~
Failure as a human
10,399 posts since Jun 2006
Reputation Points: 2,496 [?]
Q&As Helped to Solve: 993 [?]
Skill Endorsements: 72 [?]
Administrator
Featured
 
0
 

It really depends on the point of view or the angle from which u are judging the problem or the argument.

C++ can be used to write procedure oriented as well as Object oriented in an easy manner so from this point of view C is subset of C++.
I know there is also object oriented C but thats not very widely used as ppl very much prefer to migrate to C++ for OOP rather than useing Objective C.

Does C support Operator Overloading, Funciton overloading, Function overriding, Virtual funcitions, etc. etc.

I hope u get the drift.

Member Avatar
Ancient Dragon
Achieved Level 70
27,688 posts since Aug 2005
Reputation Points: 5,234 [?]
Q&As Helped to Solve: 3,042 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

since C existed long before C++, that makes C++ a superset. C++ intereted stuff from C, not the other way around. You inhereted certain features from your mother and dad, they didn't inherit them from you.

Member Avatar
~s.o.s~
Failure as a human
10,399 posts since Jun 2006
Reputation Points: 2,496 [?]
Q&As Helped to Solve: 993 [?]
Skill Endorsements: 72 [?]
Administrator
Featured
 
0
 

Yes but the newer generation is always much more enhanced, better than the older generation, and has all the features of the older generation and much more.

SO it depends on the way u look at things, if inheritance wise then as we inherit from our parents we are the subset but if u go feature and functionality wise then its C++ which holds the fort.

But opinions can vary.
Didnt mean to contradict u, jsut expressing the logical.

Bye.

Member Avatar
Ancient Dragon
Achieved Level 70
27,688 posts since Aug 2005
Reputation Points: 5,234 [?]
Q&As Helped to Solve: 3,042 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

>>Didnt mean to contradict u, jsut expressing the logical.

not a problem. Unlike some people I am wrong sometimes. If I were perfect then I would probably be ruler of this planet :cheesy:

Member Avatar
~s.o.s~
Failure as a human
10,399 posts since Jun 2006
Reputation Points: 2,496 [?]
Q&As Helped to Solve: 993 [?]
Skill Endorsements: 72 [?]
Administrator
Featured
 
0
 

Thanks a lot for understanding, i wouldn't want to upset a senior member with my postings. ;)

Member Avatar
Ancient Dragon
Achieved Level 70
27,688 posts since Aug 2005
Reputation Points: 5,234 [?]
Q&As Helped to Solve: 3,042 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

>>..: Its the ignorance of the youth that hurts the world :..

but its the spirit and enthusiasm of youth that keeps it going:)

Member Avatar
~s.o.s~
Failure as a human
10,399 posts since Jun 2006
Reputation Points: 2,496 [?]
Q&As Helped to Solve: 993 [?]
Skill Endorsements: 72 [?]
Administrator
Featured
 
0
 

Yeah right, thats an old Japanese saying and is probably right considering the way things currently are shaping up in this world. Kids with no respect for their nation, no respect for elders and so on.

But yes maybe u are right, its the spirit and enthusiasm of some young ppl that makes the world go round.

PS: Mr. Dragon, u really are observant.

Member Avatar
SuperKoko
Newbie Poster
10 posts since May 2006
Reputation Points: 3 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

c++ has all those things too and that makes C++ a superset of C although there are a few things in C that are implemented slightly differently in C++.

Did you read my post?
All what I listed (except complex numbers) are NOT available in C++.

Y is a superset of X means that for any x in X, x is also in Y

The list I gave is a list of x that are in C but are not in C++
Thus C++ is not a superset of C

You can deem that C++ is a superset of C89, but NOT of C99

And noone implied that you can write a C front-end for C++, that implies c++ would be a subset of C, not the other way around.

False!

The fact that you can write a front-end that translates language X (C for example) to language Y (C++ for example), proves, that functionally Y is as powerful as (or more powerful) than X.
In practice, all programming languages are functionally identical (they are turing-universal).... But, when the translation is very very inefficient, we can deem that Y is more powerful than X.

Functionally C89 and C++ are equivalent (even though, there are a lot of things that are much more convenient to do in C than in C++).
It means that you can write both an *efficient* front-end that converts C++ to C89 or C89 to C++.

C99 is functionally superior to C++, which means that you can easily write an *efficient* and portable front-end that converts C++ code to C99, but you can't write an efficient portable front-end that converts C99 code to C++ code.


I think that the fact that C++ was originally implemented as an efficient C front end confused you... It only proves that, functionally, C++ is as good (or less goot) than C89.
The fact that C++ is (at least functionally) a superset of C89, proves, with the previous sentence, that C++ and C89 are functionally equivalent.

But, for example, make the hypotesis that C++ has an efficient front-end converting C++ code to language X code, but that language X can't be efficiently converted to C++... It would prove that C++ is functionally less powerful than language X... If I admit your statement, it would prove that C++ is functionally more powerful than language X.
Your statement is obviously wrong.

Member Avatar
~s.o.s~
Failure as a human
10,399 posts since Jun 2006
Reputation Points: 2,496 [?]
Q&As Helped to Solve: 993 [?]
Skill Endorsements: 72 [?]
Administrator
Featured
 
1
 

Software development nowadays is all about correct and efficient practices which makes the life of programmer easier for him to code as well as to maintain the code. Todays software development is more about effiecient Object Oriented Practices and following the UML standards to deliver quality and bug free software.

C was originally intended for developing Operating systems and its main asset was its speed considering the amout of memory old computers had. Today seeing the fast drop in dollar / MB of memory its more expected from a language to make the coding and maintenance easier for the programmer ie the language that has solid OO features.

All the above talk was to clear the point that it all depends on the subject matter under consideration. You would next talk about implementing or writing Assembly front end in Machine code and go out to tell that Assembly is the subset of Machine Code. This though is true it also implies that Machine code is the superset of each and every language present today.

I dont think the original poster wanted a C v/s C++ battle for pointing out to him that C++ front end can be easily implemented in C but rather which language is better for developing applications and which language the software community nowadays goes with.

But seeing from ur profile that u are an Assembly programmer, ur love for C is well understood but the point here is that it all depends on the original posters view point.

But still ALL PEACE.

Member Avatar
Ancient Dragon
Achieved Level 70
27,688 posts since Aug 2005
Reputation Points: 5,234 [?]
Q&As Helped to Solve: 3,042 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

>>C99 is functionally superior to C++,

probably because c++ standards predate C99. It will probably catch up the next time it is updated. If it doesn't then it only means c++ is NO LONGER a subset of C -- they then become two distinctly different languages.

Member Avatar
SuperKoko
Newbie Poster
10 posts since May 2006
Reputation Points: 3 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Software development nowadays is all about correct and efficient practices which makes the life of programmer easier for him to code as well as to maintain the code. Todays software development is more about effiecient Object Oriented Practices and following the UML standards to deliver quality and bug free software.

C was originally intended for developing Operating systems and its main asset was its speed considering the amout of memory old computers had. Today seeing the fast drop in dollar / MB of memory its more expected from a language to make the coding and maintenance easier for the programmer ie the language that has solid OO features.

All the above talk was to clear the point that it all depends on the subject matter under consideration. You would next talk about implementing or writing Assembly front end in Machine code and go out to tell that Assembly is the subset of Machine Code. This though is true it also implies that Machine code is the superset of each and every language present today.

I dont think the original poster wanted a C v/s C++ battle for pointing out to him that C++ front end can be easily implemented in C but rather which language is better for developing applications and which language the software community nowadays goes with.

But seeing from ur profile that u are an Assembly programmer, ur love for C is well understood but the point here is that it all depends on the original posters view point.

But still ALL PEACE.

I think you didn't understood the intent of my post.
It was only an objective consideration of mathematical comparison of C and C++ features.
My point was not at all that C is better than C++ or that C++ is better than C.

My point was, that functionally, C++ is not a superset of C99 (though, functionally it is a superset of C89).

I love much C++ (and don't really use C, though I know the language) so I would never claim that one language is better than the other. That was only a mathematical point-of-view.

Member Avatar
SuperKoko
Newbie Poster
10 posts since May 2006
Reputation Points: 3 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

>>C99 is functionally superior to C++,

probably because c++ standards predate C99. It will probably catch up the next time it is updated. If it doesn't then it only means c++ is NO LONGER a subset of C -- they then become two distinctly different languages.

I think, you mean "superset"

You're right : C and C++ are now two different languages, and the divergence should be corrected in C++0X.

Member Avatar
Ancient Dragon
Achieved Level 70
27,688 posts since Aug 2005
Reputation Points: 5,234 [?]
Q&As Helped to Solve: 3,042 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

Not to beat a dead horse, I just stumbled across this article The Development of the C Language by Dennis Ritchie at Bell Labs

More recent descendants of C proper include Concurrent C [Gehani 89], Objective C [Cox 86], C* [Thinking 90], and especially C++ [Stroustrup 86]. The language is also widely used as an intermediate representation (essentially, as a portable assembly language) for a wide variety of compilers, both for direct descendents like C++, and independent languages like Modula 3 [Nelson 91] and Eiffel [Meyer 88].

and from a paper written by Bjarne Stroustrup

2. C with classes
C++ evolved from earlier versions called C with classes. The work and experience with C with Classes from 1979 to 1983 determined the shape of C++.

Member Avatar
Dave Sinkula
long time no c
4,852 posts since Apr 2004
Reputation Points: 2,398 [?]
Q&As Helped to Solve: 340 [?]
Skill Endorsements: 69 [?]
Team Colleague
 
0
 

More masochistic equine necrophilia:
C++

Influenced by: C, Simula, Ada 83, CLU
Influenced: Ada 95, C#, Java, PHP, D

Yada, yada. Lots of languages are influenced by one another:
History of Programming Languages

Subset and superset are really provocative terms that mean little. Each language is its own language, whatever common syntax and such that may exist.

I think the question about differences between C and C++ has been mentioned, that language theories have been discussed, and that this thread is officially dead.

[As always, if you feel strongly enough that you would like this thread reopened, PM a mod.]

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article