C or C++

Get help on programming - C++, Java, Delphi, etc.
phah
Registered User
Posts: 5
Joined: 11 May 2003, 02:00
Contact:

C or C++

Post by phah »

first post
<BR>
<BR>What is the real difference between C and C++. What I think is that C++ is a more advanced form of C like from pascal to Turbo Pascal with objects, or sumting similar.
<BR>
<BR>So if C++ is indeed what I think it is, (a better version of C), why is it that people still use C and C++ compilers have a option for compiling in C? What´s the point? Anything you do in C can be done in C++ right!?
<BR>
<BR>one
Synkronos
Moderator Emeritus
Posts: 1914
Joined: 13 Mar 2003, 02:00
Location: Cape Town
Contact:

C or C++

Post by Synkronos »

Many EPROM chips can run C code. They however do not have all the extra compiler info for the ++ part. I´m sure there are other reasons, but that´s the one I know about, having studied Electrical Engineering.
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
AngryRabbit
Registered User
Posts: 988
Joined: 24 Feb 2003, 02:00
Location: Warner Beach, Natal

C or C++

Post by AngryRabbit »

Not sure why people still use C, but C++ is object based (you can re-use the code) and C is not.
Image
snipeers
Registered User
Posts: 216
Joined: 13 Jun 2002, 02:00
Location: Eastern Cape SA
Contact:

C or C++

Post by snipeers »

<!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>
<BR>On 2003-05-12 08:57, AngryRabbit wrote:
<BR>Not sure why people still use C, but C++ is object based (you can re-use the code) and C is not.
<BR>
<BR></BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>even me i dunno why a lot of people are still using Unix instead of GUI-OSes that are easy to use like Windows and *ugh Mac OS X ugh*
<BR> <IMG SRC="images/forum/smilies/icon_confused.gif">
<html>
<body bgcolor="green">
<img src="http://uk.geocities.com/snipeers/snipeersavatar">
<i><b><font color="blue">...if the Internet is the end result of our technological evolution, i'd rather be an ape</font></b></i>
AngryRabbit
Registered User
Posts: 988
Joined: 24 Feb 2003, 02:00
Location: Warner Beach, Natal

C or C++

Post by AngryRabbit »

What language is windows programed in?
Image
LordRage
Registered User
Posts: 2092
Joined: 08 May 2003, 02:00
Contact:

C or C++

Post by LordRage »

I might be mistaken but I think windows is C++. also just an interesting fact.. Windows XP has more than 40 million lines of code!!! that is alot . now u know why firms have groups of developers.
Catch a man a fish, and you can sell it to him. Teach a man to fish, and you ruin a wonderful business opportunity. (Karl Marx)
phah
Registered User
Posts: 5
Joined: 11 May 2003, 02:00
Contact:

C or C++

Post by phah »

you comments left me more confused. I know that c++ is object warra warra. but why do people still use C .
<BR>
<BR>to write CGI files can you use C++ ?
LordRage
Registered User
Posts: 2092
Joined: 08 May 2003, 02:00
Contact:

C or C++

Post by LordRage »

Not sure really (about CGI) but some developers still use C because they want to, they are happy with what they have, just like some C++ programmers Have gone to C# and some havent, you need to speak to someone who has used both languages, (i havent used C, but i have used C++) so i cannot give you the advice you need, try emailing microsoft, I have found that they are very responsive, any way I have an exam just now so i must go!!
Catch a man a fish, and you can sell it to him. Teach a man to fish, and you ruin a wonderful business opportunity. (Karl Marx)
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

C or C++

Post by Kronos »

C is still only used for backward compatibility (Like COBOL.) All new embeded ROMs support C++. As for the differences: C is procedural, ie. No objects or classes (u can put functions in a struct so that it acts like class but the data is still public by default). C++ is Somewhat Object oriented(u can still write procedural programs in C++.) But its true power is in its OO side (im not going to go into all the details of OOP.) C++ also uses streams for all I/O, which are in fact objects ("cout" for example is an object of the "ostream" class.) Many developers use fully OO languages Like Java and c# (Everything must be an object), and many use C++ to write COM+ Objects For use in C#. (C# only works for .NET though.) I hope that answered your question.
Image
phah
Registered User
Posts: 5
Joined: 11 May 2003, 02:00
Contact:

C or C++

Post by phah »

thanks
<BR>
nicc777
Registered User
Posts: 23
Joined: 30 May 2003, 02:00
Location: Johannesburg
Contact:

C or C++

Post by nicc777 »

I have not read so much bull in a long time... C is a far superior language then C++, for a couple of reasons. The best reason for me is that it´s stil the best for low level stuff - like kernel hacking. I suggest you have a look at <!-- BBCode auto-link start --><a href="http://www.themoebius.org.uk/tutes/ckernel.html" target="_blank">http://www.themoebius.org.uk/tutes/ckernel.html</a><!-- BBCode auto-link end -->
<BR>
<BR>Cheers
If women didn\'t exist, all the money in the world would have no meaning.
-- Aristotle Onassis
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

C or C++

Post by Kronos »

Speak for yourself!!! Bjarne Stroustrup himself will B**** Slap you for saying something like that. C++ was designed to overcome the flaws and lackings of C. I Don´t know what kernel you hack but the latest versions are all C++ or Java. Try to move forwards in life, not back. C is as redundant as COBOL for f*** sakes. <IMG SRC="images/forum/smilies/icon_evil.gif"> Sorry for my surge of fury there, but this is just so ridiculous i can´t control myself. Why on god´s green earth would you prefer C?!? Have you ever really worked on C++? And have you forgotten that C++ still supports the entire C Language? <IMG SRC="images/forum/smilies/icon_rolleyes.gif">
<BR>
Image
simmy
Registered User
Posts: 3981
Joined: 24 Jun 2003, 02:00
Location: Cape Town
Contact:

C or C++

Post by simmy »

I Know C++ is better that C but,
<BR>Dude, how can u say <!-- BBCode Start --><B>COBOL</B><!-- BBCode End --> is redundant? <IMG SRC="images/forum/smilies/icon_confused.gif">
<BR>
carribus
Registered User
Posts: 1
Joined: 24 Jun 2003, 02:00
Location: Johannesburg
Contact:

C or C++

Post by carribus »

The main difference between C and C++ is this: C is a structured language, and C++ is a object oriented language.
<BR>Windows until 2000 was written in C, and any additional code to Windows (as in XP and 2003 Server) is C++ based.
<BR>C is still used because it is (a) a bit faster than C++ (because of the OOP), and (b) is necessary for low level development environments.
<BR>C++ however gives developers all the power of C, plus allows us use Object Oriented design principles such as patterns.
<BR>´nuff said?
<BR>If you wanna learn either of the languages, I would suggest learning C first, and then C++. Always get your roots <IMG SRC="images/forum/smilies/icon_wink.gif">
<A HREF="http://www.kinkycode.com">kinkycode.com</A><br>All good things were meant to be improved...
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

C or C++

Post by Kronos »

I don´t mean to diss any COBOL programmers, simmy, but it is one of the oldest languages around. I am very much for progress and therefore don´t like all this backward compatibility stuff. All new languages like C++ and Java are much better for large scale projects (Enter OOP.) It has been proven over and over again. Sure C is good, always has been, but C++ is just better.
<BR>
<BR>If you say that C is better for low level stuff, that might be true, but then you´d have to admit that assembly (or so help me god, MACHINE LANGUAGE) is even better than C. But how many ppl are up to writing everything in asm?!?!?
Image
snipeers
Registered User
Posts: 216
Joined: 13 Jun 2002, 02:00
Location: Eastern Cape SA
Contact:

C or C++

Post by snipeers »

<!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>Speak for yourself!!! Bjarne Stroustrup himself will B**** Slap you for saying something like that.</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>although i can´t really speak for the other guy, i think what he meant is most programmers still prefers using C for many *nix´es kernel development/tuning but saying that <i>C is a far superior language than C++</i> is quite an overstatement. both languages have there advantages - C being used more in systems programming while C++ in OOP. i like C´s dual nature being both a HLL and LLL while C++ can be classified as an outright HLL.
<BR>
<BR><!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>C++ was designed to overcome the flaws and lackings of C.</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>i really was a bit lacking these days, can you brief us about those flaws that C have and that C++ was designed to overcome? as a systems programming language, C works just fine for me.
<BR>
<BR><!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>I Don´t know what kernel you hack but the latest versions are all C++ or Java.</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>well, can it be said to all *nix´es based OSes. afaik, even Windows still uses lines of C codes to check for buffer overflows.
<BR>
<BR><!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>Try to move forwards in life, not back.</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>that´s why i use C instead of assembler languages, i don´t think that´s a step backwards.
<BR>
<BR><!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>C is as redundant as COBOL for f*** sakes.</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>...and since Unix is largely written in C maybe you might as well add that it is a redundant OS, and so is Linux and other *nix´es variant. is that what you mean?
<BR>
<BR>can you please tell us why are we still using Unix these days (mostly in mainframes) instead of GUI-based OSes like Windows and OS X. (note though that OS X is based on BSD - a Unix variant).
<BR>
<BR>
<BR><!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>Why on god´s green earth would you prefer C?!?</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>programmers still uses an old language like C mainly because *nix´es OS still uses it in there system calls, C allows greater access to many machine-level features which would have require an assembly language and, as you´ve stated, for backward compatibility.<BR><BR><font size=-1>[ Edited by snipeers On Date <br>June 25, 2003 ]</font>
<html>
<body bgcolor="green">
<img src="http://uk.geocities.com/snipeers/snipeersavatar">
<i><b><font color="blue">...if the Internet is the end result of our technological evolution, i'd rather be an ape</font></b></i>
snipeers
Registered User
Posts: 216
Joined: 13 Jun 2002, 02:00
Location: Eastern Cape SA
Contact:

C or C++

Post by snipeers »

the *<i>real</i>* origins of the C programming language.
<BR>
<BR>There is a common misconception that <b>C</b> was invented in 1972 by Dennis Ritchie.The truth is that it was actually invented about 100 years earlier by an obscure religious cult in Texas. Their leader had a vision of machines that could be programmed. He instructed his followers to develop a programming language for these machines so that his cult would be able to use them to take over the world.
<BR>
<BR>The programming language they produced was the original version of the <b>C</b> programming language. People living near the cult heard stories of how they were going to take over the world, got scared and attacked them, raizing their settlement to the ground. Only three members of the cult survived.
<BR>
<BR>They wanted to pass their knowledge of <b>C</b> programming on to future generations, but were too scared to write anything down(*). Instead they invented dozens of campfire stories, containing all the information required to program in <b>C</b>, that they taught to their children. Rather than inventing <b>C</b> in 1972, Dennis Ritchie simply reconstructed the language from his many long nights round the campfire spent listening to folk stories.
<BR>
<BR>(*) There is a legend that one of the survivors managed to save manuscripts that detailed the original <b>C</b> language specification and also answers to common homework problems. It is said that he buried these in the Nevada desert. After the cult was destroyed it was never thought that <b>C</b> would ever be resurrected, which is why these manuscripts were known as the <b>"Dead C Scrolls"</b>.
<BR>
<BR><i>adapted from usenet.</i>
<html>
<body bgcolor="green">
<img src="http://uk.geocities.com/snipeers/snipeersavatar">
<i><b><font color="blue">...if the Internet is the end result of our technological evolution, i'd rather be an ape</font></b></i>
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

C or C++

Post by Kronos »

Sorry for that. You put me in my place. I´m just a big supporter of OOP and C++ in general. I say that C++ is better because it supports everything, C, C++ and asm.
Image
Mire
Registered User
Posts: 27
Joined: 03 Jul 2003, 02:00
Location: Pretoria

C or C++

Post by Mire »

Pardon me if I am wrong, but the way I see it, the OOP model only affects the amount of code the programmer has to type. All of the objects, and all of the higher level language components (except maybe error-trapping) get converted into the lower level C code when the code is compiled so:
<BR>
<BR>1. The embedded chips that run C++ aren´t actually different from the ones that run C, they are just compiled with a different compiler.
<BR>
<BR>2. Since C++ supports all of C´s functionality (including embedded assembler), there is no reason why C++ shouldn´t replace C. However the change to OOP can be daunting to learn, and the statement above can be switched around (C can do everything C++ can do), so I think if you are comfortable with C there is nothing wrong with that.
<BR>
<BR>To all of those ´holier than thou´ C++ programmers, have a little respect. Those functions you take for granted in C++, can be and are programmed by hand by C programmers, and that takes skill.
<BR>
<BR>My personal preference is C++ <IMG SRC="images/forum/smilies/icon_smile.gif"> .
Build a man a fire, and he\'s warm for a couple of hours. Set him alight, and he\'s warm for the rest of his life! -- Terry Pratchett
snipeers
Registered User
Posts: 216
Joined: 13 Jun 2002, 02:00
Location: Eastern Cape SA
Contact:

C or C++

Post by snipeers »

<!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>
<BR>On 2003-07-07 11:21, Mire wrote:
<BR>
<BR>My personal preference is C++ <IMG SRC="images/forum/smilies/icon_smile.gif"> .
<BR>
<BR></BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>... and my personal preference though is K++.
<BR>
<BR> <IMG SRC="images/forum/smilies/icon_cool.gif">
<html>
<body bgcolor="green">
<img src="http://uk.geocities.com/snipeers/snipeersavatar">
<i><b><font color="blue">...if the Internet is the end result of our technological evolution, i'd rather be an ape</font></b></i>
Mire
Registered User
Posts: 27
Joined: 03 Jul 2003, 02:00
Location: Pretoria

C or C++

Post by Mire »

<IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif">
<BR>
<BR>Just when I thought I had made a serious and profound post, for the general betterment of mankind, snipeers had to go and kick my ego in the voonerables.
<BR>
<BR> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif">
Build a man a fire, and he\'s warm for a couple of hours. Set him alight, and he\'s warm for the rest of his life! -- Terry Pratchett
snipeers
Registered User
Posts: 216
Joined: 13 Jun 2002, 02:00
Location: Eastern Cape SA
Contact:

C or C++

Post by snipeers »

<!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-1>Quote:</font><HR></TD></TR><TR><TD><FONT SIZE=-1><BLOCKQUOTE>
<BR>On 2003-07-14 14:52, Mire wrote:
<BR> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif">
<BR>
<BR>Just when I thought I had made a serious and profound post, for the general betterment of mankind, snipeers had to go and kick my ego in the voonerables.
<BR>
<BR> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif"> <IMG SRC="images/forum/smilies/icon_lol.gif">
<BR></BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>i´m just sooo bored about these C/C++ battle royale <i>"which is the best language" kinda discussion. i´ve been thru this a loooong time back in some newsgroups and i just feel sorry to those people who are constantly preaching that C is a dead language and should be replaced but it just didn´t died and IMO it won´t happen any time soon (ATS) coz C is an ever evolving language.
<html>
<body bgcolor="green">
<img src="http://uk.geocities.com/snipeers/snipeersavatar">
<i><b><font color="blue">...if the Internet is the end result of our technological evolution, i'd rather be an ape</font></b></i>
Last-Attacker
Registered User
Posts: 696
Joined: 04 Sep 2003, 02:00

Post by Last-Attacker »

Ok, I havn't read all the threads but here the thing:

C can be programmed and compiled in C++.
C is object-less.
C++ can inherit objects.
Both supports Inline assembly and are portable to any operating system (ie. to compile in linux with Linux specifications in your code, etc).
C++ is more popular with new things like Templates, operator overloading, advanced casting (ie. static_cast<type>(expression), also can use C-casting), etc.

Even though C++ is more advanced and stronger than C, it is still C programming platform because C++ was supposed to extend from it and a few things limits C++ because of this, but the limits are barely even needed.

Some people say that C is faster than C++ because of its simplicity, I say its not the language that makes it faster but the compiler! If you have a powerfull compiler then C-code and C++ - code can run evenly fast.

Well thats basically what I can think of between C and C++.
Last-Attacker
Registered User
Posts: 696
Joined: 04 Sep 2003, 02:00

Post by Last-Attacker »

O yeah, just like there is a ARB Board that controls the standards for OpenGL, so it there a institution that controls the standards for C++ (I dunno who but apparently there is one). Thus C++ whill remain up to date while C fades away in the old dust of time :D

Just kinning, I read a few threads and I saw you guys battle it out between C and C++ and I don't want to get caught up in the cross-fire :wink: .

But people have to use an up to date language one time or another, so why not use C++? It basically like a class inheriting from C. Now we have a C++ class!
snipeers
Registered User
Posts: 216
Joined: 13 Jun 2002, 02:00
Location: Eastern Cape SA
Contact:

Post by snipeers »

Last-Attacker wrote:O yeah, just like there is a ARB Board that controls the standards for OpenGL, so it there a institution that controls the standards for C++ (I dunno who but apparently there is one). Thus C++ whill remain up to date while C fades away in the old dust of time :D
that's not true.

<i>In 1983, the American National Standards Institute (ANSI) formed a committee, X3J11, to establish a standard specification of C. After a long and arduous process, the standard was completed in 1989 and ratified as ANSI X3.159-1989 "Programming Language C". This version of the language is often referred to as ANSI C. In 1990, the ANSI C standard (with a few minor modifications) was adopted by the International Standards Organization (ISO) as ISO/IEC 9899:1990

After the ANSI standardization process, the C language specification remained relatively static for some time, whereas C++ continued to evolve. (Normative Amendment 1 created a new version of the C language in 1995, but this version is rarely acknowledged.) However, the standard underwent revision in the late 1990s, leading to the publication of ISO 9899:1999 in 1999. This standard is commonly referred to as "C99". It was adopted as an ANSI standard in March 2000.</i>

LINK
Post Reply