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

C and C++

I have a question on how closely C and C++ are related. If i am
correct C++ is OOP while C is not. Now how closely can an OOP language
and a procedural language be related? How much knowledge of C is
required to understand C++? Thanks.

Mar 3 '06 #1
19 1792
wilberX wrote:
I have a question on how closely C and C++ are related. If i am
correct C++ is OOP while C is not. Now how closely can an OOP language
and a procedural language be related? How much knowledge of C is
required to understand C++? Thanks.


To what purpose will you put the answer?

C++ is C with a few keywords added and just a couple bugs removed.

Those new keywords permit better OOP style. Folks have written OOP in C
since forever; it's just harder.

Now you define OOP before asking what the difference between the languages
is.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Mar 3 '06 #2
wilberX wrote:
I have a question on how closely C and C++ are related. If i am
correct C++ is OOP while C is not. Now how closely can an OOP language
and a procedural language be related? How much knowledge of C is
required to understand C++? Thanks.


Start here: http://public.research.att.com/~bs/bs_faq.html

V
--
Please remove capital As from my address when replying by mail
Mar 3 '06 #3

"wilberX" <wi******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
I have a question on how closely C and C++ are related.
Fairly closely.
If i am
correct C++ is OOP while C is not.
C++ has native facitilies which support OOP,
but that's only one of several programming styles
it supports.
Now how closely can an OOP language
and a procedural language be related?
C++ isn't *only* an OOP language. One can
write procedural code with it as well. Both
C and C++ can be considered 'general purpose'
languages.

How 'close' C and C++ are depends upon your notion
of 'close'. E.g. the syntax of one is quite similar
to that of the other. But the semantics are often
different.
How much knowledge of C is
required to understand C++?
None at all.
Thanks.


You're welcome.

-Mike
Mar 3 '06 #4

Phlip wrote:

C++ is C with a few keywords added and just a couple bugs removed.

I wouldn't characterize C++ so lightly. Have you forgotten about
operator overloading, exception handling, templates, namespaces, and
the STL?? A person graduating from C to C++ has somewhat of a steep
learning curve if he/she wants to develop good, quality code.
Those new keywords permit better OOP style. Folks have written OOP in C
since forever; it's just harder.


True, one can essentially create an "object" using the struct
mechanism.

Mike.

-----
ACGNJ Java Users Group
http://www.javasig.org/

Mar 3 '06 #5
Michael Redlich wrote:
Phlip wrote:

C++ is C with a few keywords added and just a couple bugs removed.


A person graduating from C to C++ has somewhat of a steep
learning curve if he/she wants to develop good, quality code.


Your statement sounds like you're infering that C++ is better than C
since you suggest that people graduate from C to C++. This really
isn't true in every case, both languages have tasks for which each is
better than the other. The linux kernel is writen in C, not C++. I
would bet most of the developers for the linux kernel would take issue
with the statement that they needed to graduate to C++.
Those new keywords permit better OOP style. Folks have written OOP in C
since forever; it's just harder.


True, one can essentially create an "object" using the struct
mechanism.


True, but that's not enough to support OOP. You also need to implement
your own way of handling dynamic binding to support polymorphism.

-Brian

Mar 4 '06 #6
"wilberX" writes:
How much knowledge of C is
required to understand C++? Thanks.


None at all is required. C++ is a complete (albeit irritating) free
standing language
Mar 4 '06 #7
BigBrian wrote:
Michael Redlich wrote:
Phlip wrote:

C++ is C with a few keywords added and just a couple bugs removed.


A person graduating from C to C++ has somewhat of a steep
learning curve if he/she wants to develop good, quality code.


Your statement sounds like you're infering that C++ is better than C
since you suggest that people graduate from C to C++. This really
isn't true in every case, both languages have tasks for which each is
better than the other. The linux kernel is writen in C, not C++. I
would bet most of the developers for the linux kernel would take issue
with the statement that they needed to graduate to C++.


The debate of "this language is better than that language" is pointless,
especially when the arguments given have no merit. Linux kernel is not
written in C because C is "better". It's written in C because most of
who are contributing, have no time, nor desire to graduate to C++. Or
because they are simply afraid or contemptuous (or both).

V
--
Please remove capital As from my address when replying by mail
Mar 4 '06 #8
Michael Redlich wrote:
True, one can essentially create an "object" using the struct
mechanism.


You can program in entirely object oriented ways in C! The first
extensive use of object oriented programming in C I came across is
Xt, the X toolkit implementing widgets on top of X11. Each widget
was derived using a certain convention on how to use structs. This
supported run-time polymorphism very much like 'virtual' functions
do in C++. Of course, this required some form of manual set up of
something similar to a virtual function table (effectively a struct
describing the class and which function to call effectively).
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
Mar 4 '06 #9
Victor Bazarov wrote:
The debate of "this language is better than that language" is pointless,
especially when the arguments given have no merit. Linux kernel is not
written in C because C is "better". It's written in C because most of
who are contributing, have no time, nor desire to graduate to C++. Or
because they are simply afraid or contemptuous (or both).


.... or those involved in implementing the Linux kernel consider C to
be the more appropriate tool. The fact that C and its ABI is pretty
stable since ages and that GCC's C compiler is less buggy than GCC's
C++ compiler also adds to the reasons in favor of C. Although I would
prefer to use C++ as a language, I can agree with many of the reasons
people have for using C. Of course, I also disagree with at least
some reasons given in favor of C.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
Mar 4 '06 #10
"BigBrian" <wo**@brianmielke.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
Michael Redlich wrote:
Phlip wrote:
>
> C++ is C with a few keywords added and just a couple bugs removed.
>


A person graduating from C to C++ has somewhat of a steep
learning curve if he/she wants to develop good, quality code.


Your statement sounds like you're infering that C++ is better than C
since you suggest that people graduate from C to C++. This really
isn't true in every case, both languages have tasks for which each is
better than the other. The linux kernel is writen in C, not C++. I
would bet most of the developers for the linux kernel would take issue
with the statement that they needed to graduate to C++.


I read an article (web page discussion) about why the linux kernal is still
in C and not C++. They had looked at implementing it in C++ but new would
give them many of problems. In a kernal memory is allocated in many
differnt places, since the kernal is the one that is ultimately responsible
for allocating the memory that new uses.

They could of used C++ if they were to limit uses of new, but it was decided
that since a lot of people work on the kernal that some programmer wouldn't
be aware of all the limitations and use new where they weren't supposed to
(or even std templates that use alloc such as std::string) and break things.

From what I read they would of used C++ for the kernal if they could without
these problems. So it wasn't a fact of C++ being inferior to C, but the
fact that wasn't the best language for the use.

If I program on an AS/400 I'll most likely use RPG (Report Program
Generator) even though you can get a C or C++ compiler. RPG is not better
than C or C++, but it is the most appropriate langauge for the use.

Also, it could be argued that C is a subset of C++, or C++ is a superset of
C. You can still program a C program in C++ without using any of the C++
objects or such with minimal changes.

In my opionion, no langauge is better than any other langauge. Languages
are designed with specific purposes in mind when they are designed. If they
are used for that purpose, then they are probably the best langauge for that
purpose.
Mar 4 '06 #11

BigBrian wrote:


A person graduating from C to C++ has somewhat of a steep
learning curve if he/she wants to develop good, quality code.


Your statement sounds like you're infering that C++ is better than C
since you suggest that people graduate from C to C++. This really
isn't true in every case, both languages have tasks for which each is
better than the other. The linux kernel is writen in C, not C++. I
would bet most of the developers for the linux kernel would take issue
with the statement that they needed to graduate to C++.


I don't see how my statement implied that C++ is *better* than C. I
was merely trying to point out that there is more to learning C++ than
Philip seemed to make it out to be. Maybe I shouldn't have used the
term "graduated." It was simply a metaphor for someone who is a C
developer that is interested in learning C++. I also should have said,
"good, quality C++ code."

True, one can essentially create an "object" using the struct
mechanism.


True, but that's not enough to support OOP. You also need to implement
your own way of handling dynamic binding to support polymorphism.


I also didn't say that you could *fully* support OOP with C. That's
why I use C++ and Java...

That's the problem with these Usenet groups. There's no face-to-face
interaction, and there's potential for misunderstandings because these
groups are global. I'm from New Jersey, and you all know how we talk
over here: "Yea, I'm from Joisey..." :-)

Mike.

-----
ACGNJ Java Users Group
http://www.javasig.org/

Mar 4 '06 #12

Jim Langston wrote:

In my opionion, no langauge is better than any other langauge. Languages
are designed with specific purposes in mind when they are designed. If they
are used for that purpose, then they are probably the best langauge for that
purpose.


Amen, brother! I couldn't agree more...

Mike.

-----
ACGNJ Java Users Group
http://www.javasig.org/

Mar 4 '06 #13
In article <03***************@fe03.lga>,
ta*******@rocketmail.com says...

[ ... ]
In my opionion, no langauge is better than any other langauge. Languages
are designed with specific purposes in mind when they are designed. If they
are used for that purpose, then they are probably the best langauge for that
purpose.


Obviously you've never tried to use Intercal, UnLambda or
brainf*(k. Some languages are definitely worse than
anything that could possibly be considered rational, sane
or intelligent.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Mar 4 '06 #14
TB
Jim Langston skrev:
<snip>

In my opionion, no langauge is better than any other langauge. Languages
are designed with specific purposes in mind when they are designed. If they
are used for that purpose, then they are probably the best langauge for that
purpose.


Well, most commercial languages are classified as "general-purpose",
hence lack the fourth generation specialization. But they do have
different designs that easier promotes the langauges over others in
certain problem domains (today most obvious on the oop stage).

--
TB @ SWEDEN
Mar 4 '06 #15
TB
Jerry Coffin skrev:
In article <03***************@fe03.lga>,
ta*******@rocketmail.com says...

[ ... ]
In my opionion, no langauge is better than any other langauge. Languages
are designed with specific purposes in mind when they are designed. If they
are used for that purpose, then they are probably the best langauge for that
purpose.


Obviously you've never tried to use Intercal, UnLambda or
brainf*(k. Some languages are definitely worse than
anything that could possibly be considered rational, sane
or intelligent.


You mean "brainfuck".

Esoteric languages are their own language group with their own purpose,
just like all pure research languages produced. And UnLambda has some
very interesting properties that should not be shrugged off as something
"worse than anything that could possibly be considered rational".

--
TB @ SWEDEN
Mar 4 '06 #16
On Fri, 03 Mar 2006 22:36:33 GMT, "Mike Wahler"
<mk******@mkwahler.net> wrote:
C++ isn't *only* an OOP language. One can
write procedural code with it as well. Both
C and C++ can be considered 'general purpose'
languages.


Oooo, boy... :-D

http://en.wikipedia.org/wiki/Procedural_code

"In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move."
- Douglas Adams
Mar 4 '06 #17
JustBoo wrote:

Mike Wahler mkwahler wrote:
C++ isn't *only* an OOP language. One can
write procedural code with it as well. Both
C and C++ can be considered 'general purpose'
languages.

That's the party line. Let's just say the paradigm that sucks under C++
least is OOP. ;-)
Oooo, boy... :-D

http://en.wikipedia.org/wiki/Procedural_code
The opposite of "procedural" is "event driven". OOP enables that, but it's
not the opposite of "procedural".
"In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move."
- Douglas Adams


How dare you cite holy scripture in a public forum??!

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Mar 4 '06 #18
On 2006-03-04, osmium <r1********@comcast.net> wrote:
"wilberX" writes:
How much knowledge of C is
required to understand C++? Thanks.


None at all is required. C++ is a complete (albeit irritating) free
standing language


Nearly. You are stuck with the C standard library for certain things,
and you won't find that library documented in the C++ Standard.

--
Neil Cerutti
Mar 6 '06 #19
Phlip wrote:
wilberX wrote:
I have a question on how closely C and C++ are related. If i am
correct C++ is OOP while C is not. Now how closely can an OOP language
and a procedural language be related? How much knowledge of C is
required to understand C++? Thanks.


To what purpose will you put the answer?

C++ is C with a few keywords added and just a couple bugs removed.


And unfortunately a more than a few bugs propagated.
Mar 8 '06 #20

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...
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...
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.