Thread: What's the difference, really?

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Question What's the difference, really?

    Hello,
    I want to know from a programmers point of view "what is the difference of c and c++, really?"

    Is one harder or easier to write and read vs. the other?
    Is the keywords easier to remember vs. trying to memorize all the ones for c?
    what ?!?!
    peace out
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Just depends on what you are working on I guess. The syntax is obviously different but that is minor.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    C is a subset of C++.
    The difference is C is not an Object-Oriented language, C++ is.

    An Object-Oriented language is one that provides the facilities
    to do implement Object-Oriented programming.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    What's the difference? C is small and elegant while C++ only adds complexity and confusion without fixing the flaws that C has. So in the end you have the Algol-60/Algol-68 deal. I have nothing against C++, but this is my honest interpretation of its design.

    -Prelude
    My best code is written with the delete key.

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    This is just a matter of personal opinions and my opinion is not worth more then anyone else. I think that the actual solution are usally more elegent using proper C++ then C. The C code are usally cleaner to read but this is because it lacks alot of the functionality that C++ have with the STL and Classes. Once you start to add function pointers in structs and linked lists to solve what C++ does with classes and STL I think C++ makes more sense. C++ do have some flaws because of historical reasons and compability with C. Bjarne S have a good artical about this in the latest C++ developer magasin.
    Last edited by Barjor; 07-15-2002 at 02:02 PM.

  6. #6
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284
    Originally posted by The Dog
    C is a subset of C++.
    Not really
    The one who says it cannot be done should never interrupt the one who is doing it.

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by The Dog
    C is a subset of C++.
    The difference is C is not an Object-Oriented language, C++ is.

    An Object-Oriented language is one that provides the facilities
    to do implement Object-Oriented programming.
    No, it actually isn't. I believe you have that backwards:

    C++ is a subset of C. C came first, C++ was created from C (ie: based on it). Thus, C++ is a subset of C.

    C++ is also not a true "object oriented" lnaguage. It can be used in OO design, but it is not truly objective. If it actually is, then explain where there base object is here, and why it is an object:
    Code:
    int main( )
    {
        return 0;
    }
    No, C++ is a proceedural language which has aspects of an OO language. It is not a true OO language. For that, take a look at SmallTalk (arguably the best OO language ever made, which realisticly all are based on--model wise, aspirations, etc), and Java.

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    Registered User
    Join Date
    Jul 2002
    Posts
    13

    C or C++ ??

    Well,
    C and C++ are both very powerful languages,
    and within some limits we can say that C is a subset of C++. this obviously means that C++ is bigger than C

    C was designed compact by KR. C++ adds more functionality to it.
    almost all code that compiles in C,compiles in C++ also.

    this reason is not mine, one of my professors told me this:
    Preformance of C goes down when the length of code exceeds 10k lines.. C++ outperforms C here.

    also C++ is OO. so data is lot more secure in C++ than in C. Encapsulation,inherentence and polymorphism are there in C++ but not in C, as C not OO..

    hope this solves ur doubt.

  9. #9
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    Code:
    Preformance of C goes down when the length of code exceeds 10k lines.. C++ outperforms C here.
    That is an interesting comment, because I thought C++ was converted to C by the C frontend before being compiled.

    Would that be because of the ability to use OO principles should decrease the amount of code required to write some applications?
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  10. #10
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284

    Re: C or C++ ??

    Originally posted by ucsbme

    this reason is not mine, one of my professors told me this:
    Preformance of C goes down when the length of code exceeds 10k lines.. C++ outperforms C here.
    I wonder how he reached that conclusion .
    The one who says it cannot be done should never interrupt the one who is doing it.

  11. #11
    TK
    Guest
    C++ is a specialization of the C programming language. The languages retain 'link compatability'. They are both standardized by a committe, who also updates the definitions.

    C++'s OOP specializations are very broad based, more so than middleware langauges like Java and .net. However the middleware languages are pure OOP which doesn't mean a whole lot, just that every type is an object. Due to their frameworks reusable design the middleware langauges are specializations of C++.

    The main difference between C and C++ involves design modeling. The two schools are, action based and, object oriented.

    C code is not slower than C++ code, however professional C programmers use techniques to control design faults of the action based paradigm. These principals are rarely taught in most books.

  12. #12
    Registered User
    Join Date
    Jul 2002
    Posts
    273
    this is all opinion, much like any design philosophy. C++ is the new version of C so you might as well think of them as one. It's better that way.

    Once you have that down you realize you have these new features including classes. Classes are a great way to group functions and data together and separate that action from the rest of your code thus providing reusable parts and code cleanliness. many old-school types don't believe in those things but hey, I like them. It's just a nice feature added to the language and yes they should be considered the same language
    Last edited by Hershlag; 07-16-2002 at 08:24 AM.

  13. #13
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    Object-oriented programming is a technique for programming - a paradigm for writing "good" programs for a set of problems. If the term "Object-Oriented programming language" means anything, it must mean a programming language that provides mechanisms that support the object-oriented style of programming well.
    There is an important distinction here. A language is said to support a style of programming if it provides facilities that make it convenient (reasonably easy, safe, and efficient) to use that style.
    From Bjarne Stroustrup's book, The C++ Programming Language 3rd Edition.

    From the above extract, I deduce that C++ is Object-Oriented.

    As for this
    >> C is subset of C++
    It's your call.

  14. #14
    Unregistered
    Guest
    Originally posted by Hershlag
    C++ is the new version of C so you might as well think of them as one.
    really ??
    Is it possible to write a C program with lines like this ?
    Code:
    f(x)++;

  15. #15
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    C and C++ are two different languishes and they should not be mixed. They look alike and most compilers accept both but you will get in trouble if you think that C is the same as C++. Learn both but only use one at the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Review required for program of date difference
    By chottachatri in forum C Programming
    Replies: 6
    Last Post: 10-31-2008, 11:46 AM
  2. Difference Equations / Recurrence Relations
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2007, 10:26 AM
  3. What's the difference between var++ and ++var
    By ulillillia in forum C Programming
    Replies: 6
    Last Post: 05-31-2007, 02:27 AM
  4. how to get difference of digits
    By Leeman_s in forum C++ Programming
    Replies: 5
    Last Post: 12-20-2001, 08:32 PM
  5. What is the Difference between ANSI C and non-ANSI C ?
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-24-2001, 06:55 AM